Add an option to upload file
Closed this issue · 8 comments
If no filename is provided, generate a link to upload form instead, so it is possible to upload a file from phone to the server.
Hi @labdsf, thanks for the suggestion, someone is already working at this, please follow this thread: Add upload capability #8
I saw PR #8, but the code suggested there does not seem to me good enough. And it's been a while, so there may be problems with the merger.
I would like to have this feature. It seems to me that the best option is to add the "-upload" flag. If the user specified the folder in which the files will be loaded into the arguments, then load it there, otherwise save the received files to "Downloads/qr-filetransfer" or "qr-filetransfer" in the home folder.
Any thoughts?
I agree that #8 might require some refactoring.
The way I see it:
-
we should name it
-receive
flag rather than-upload
it seems more natural to me to run in my terminal
qr-filetransfer -receive -to /path/to/my/download
rather than
qr-filetransfer -upload
However, I still find it very verbose, maybe we can find a different solution
-
we should add a
-to
(or-out
or-dest
or whatever) flagIn my experience I've never seen a command line program using a default download directory (counter examples are welcome) and, personally, I wouldn't like that too much. I want it to be immediately clear to the user where the received files will be stored
-
as per current PR (#8), the destination argument is the file about to be transfered, I think it should be a directory instead
I agree that the -receive
flag looks much clearer than -upload
. But pointing the folder via the flag seems too complicated.
I see it like that: if the user did not specify a directory, then the program should output something like
Please specify the directory where the received files will be placed
and finishes the execution.
I made some progress. Some work still needs to be done, but you can already enjoy it. Criticism and suggestions are welcome.
https://github.com/brualan/qr-filetransfer
@brualan thanks for staying on this. Please open a PR so we can review from here.
The feature has been implemented!
Pass the -receive
flag and the path to a directory:
qr-filetransfer -receive ~/Downloads
By scanning the QR you will be prompted with an upload page on your mobile:
And files will be transfered to ~Downloads
. Thanks again to @brualan and @twooster for working on this.