Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] allow upload from web client #52

Open
inattendu opened this issue Jul 26, 2018 · 6 comments
Open

[Feature request] allow upload from web client #52

inattendu opened this issue Jul 26, 2018 · 6 comments

Comments

@inattendu
Copy link

Everything is in the title, it will be a perfect addition, thank you for this great work !

@mnalis
Copy link

mnalis commented Mar 10, 2021

HTTP protocol by itself does not support upload of files. What you seem to want is FTP server or WebDAV server, but they require different clients

@Ammar64
Copy link

Ammar64 commented Aug 13, 2024

@mnalis HTTP does allow files upload using POST or PUT requests.

@mnalis
Copy link

mnalis commented Aug 13, 2024

@Ammar64 you are correct of course...

While I do not remember exact idea I was trying to convey several years ago 🥲, it was probably related to the fact that shareviahttp automatically begins download when its / URL is opened, and user have no option to influence that.

To support upload, that auto-download on / would need to replaced with some placeholder page which have separate link for download and separate form (i.e. <form action=POST>) for choosing/uploading file (and shareviahttp web server have some internal CGI-equivalent to support receiving and storing that file somewhere, of course, as just POST to some random location won't upload file in that folder).

Or, better (but less discoverable), keep current / as automated download, and make a new hidden /upload endpoint which when opened would display form for upload (provided you have first started the shareviahttp web server manually on the smartphone)...

@Ammar64
Copy link

Ammar64 commented Aug 13, 2024

I have the page open when you enter the url and you get both options of Upload / Download.

@Ammar64
Copy link

Ammar64 commented Aug 13, 2024

I don't use <form method="POST"> as I think you may have to send the file in a multi-part format which requires more work on backend code to handle.

I use the JS XMLHttpRequest and I do xhr.send(form.files[0]) this will send the file and only the file content will be the body of the POST request this make it easier to handle on the Java side

XHR also allows you to get file upload progress unlike <form> which you will have to just wait until you see a sign.

@mnalis
Copy link

mnalis commented Aug 13, 2024

Ah, you seem to be talking about another FOSS app for similar purpose, https://github.com/Ammar64/Sharing, right @Ammar64 ?

That seems interesting possible alternative for shareviahttp, especially if it remains actively developed.

I've tried it out, and opened a few issues for problems I've encountered (and things which worked great for me in shareviahttp, but are lacking in Sharing app).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants