dutchcoders / transfer.sh

Easy and fast file sharing from the command-line.
https://github.com/dutchcoders/transfer.sh
MIT License
15.12k stars 1.54k forks source link

Upload files from url #411

Open wuniversales opened 2 years ago

wuniversales commented 2 years ago

I would like that you could add files from an external url, for example, pass the url of an image, or a video and that it be uploaded to this platform. Would it be possible to add the function? Thanks greetings

aspacca commented 2 years ago

@wuniversales do you mean from the command line or on the web UI?

stefanbenten commented 2 years ago

@wuniversales Could you elaborate more on the use case? Why would one not share the URL directly?

bman46 commented 2 years ago

One thing that I would use this for is storing files from urls that have a short amount of time to be accessed. For example, instagram videos have a hash and timestamp in the URL that prevent them from being viewed with that link after a couple hours.

bman46 commented 2 years ago

An example of another site doing this is https://0x0.st/. They allow a key called 'url' to be posted in the body as form data and then they handle the upload from that link.

stefanbenten commented 2 years ago

One thing that I would use this for is storing files from urls that have a short amount of time to be accessed. For example, instagram videos have a hash and timestamp in the URL that prevent them from being viewed with that link after a couple hours.

This might possibly violate rights and is not a good example in my mind.

bman46 commented 2 years ago

Regardless of the specifics, there are situations where uploading from a link would be useful. That also wont stop anyone from just uploading the file from a local copy, anyway.

stefanbenten commented 2 years ago

I totally agree, it would not stop it. But certainly make it possible to track down who uploaded it in case of an takedown/abuse request.

aspacca commented 2 years ago

One thing that I would use this for is storing files from urls that have a short amount of time to be accessed. For example, instagram videos have a hash and timestamp in the URL that prevent them from being viewed with that link after a couple hours.

on top of the abuse problem, I see another one here: what content should be upload from the url? an instagram url with an embedded video should upload html of the page or the video? the second is out of scope for transfer.sh, the first would make the example improper ;)

uploading directly a remote content, like https://0x0.st/ does, doesn't need an extra feature in transfer.sh itself, for cli: something like curl http://example.com/image.jpg -o - | curl -X PUT -d @- https://transfer.sh/image.jpg should be enough. We can provide the code of a shell function in the README or examples in UI

from web UI the same could be similarly done directly in the frontend with some javascript, only drawback is that someone hosting a custom frontend should implement the same feature independently. this would favour a support directly in the backend, but I have to think how this can fit with what we have without being an hack

@stefanbenten what do you think about the different options?

stefanbenten commented 2 years ago

I do agree having a shell alias/function for the above command is fine and easiest. In that case, it would still pass the data via the client and check all boxes in my eyes.

aspacca commented 2 years ago

we should add an example box in the frontend, @stefanbenten