SrS2225a / custom_uploader

Custom Uploader is a simple, lightweight, and easy to use file uploader built using flutter for android devices that allows you to upload files to a file host of your choice.
MIT License
39 stars 2 forks source link

wishlist: Support for WebDAV servers #8

Closed chrysn closed 5 months ago

chrysn commented 6 months ago

What you want to be added

Please consider adding support for WebDAV style servers. While WebDAV is a complex protocol, file upload could be implemented with relatively small changes (because PUT support is already present); this would need options to:

In this context, it would also be helpful to

Why you want this feature

This would enable self-hosting of an upload server with what kids these days apparently call "no code". For example, a self-hosted nginx server can support this with

        location /incoming {
                dav_access all:r;

                # only PUT is needed for this example, but doing all allows access from file managers too
                dav_methods PUT DELETE MKCOL COPY MOVE;
                dav_ext_methods PROPFIND OPTIONS;
                client_max_body_size 0;
        }

and then be configured as the upload server by setting its /incoming/ path as the upload path, the method to PUT and setting the above options. Access control would typically be used to allow only the authorized user group to use the dav methods (limit dav_access accordingly), but read access to everyone. (Depending on the desired use case, directory listings may or may not be allowed to the general public).

Screenshots

No response

SrS2225a commented 6 months ago

It should already be possible to use WebDAV as Custom Uploader already has support for these options. Here are the answers in response to your questions.

add the local file name to the upload URI set the file itself as the payload (rather than uploading form encoded data)

To upload the playload as file, in the add form, toggle the switch "Add file data to the request body" to the off position.

support HTTP authentication (eg. basic authentication)

Using HTTP Authentication is done by adding the needed key value pair to the add forms headers, paramaters, or arguments. This can be done by pressing the plus icon in the relevant editable data grid, which is then passed to http using your set arguments.

use the URL to which the upload was sent also as the output URI (if that is ever used later, not sure)

It indeed does try to parse the output uri given back from the server automatically. Sometimes though, a file server may break the uri into multiple parts, thats why additionally you can define how the url should be parsed from the server by using the "URL Response" field in the add form. If it can't parse it, it will just tell you the upload was successful.

Refer to the help section in Custom Uploader for more information, which can be found by tapping the 3 dots in the add form.

Also, in the future, I am planning on adding a "Simple" mode for the add form to make it easier for new users to add their favorite upload servers

SrS2225a commented 6 months ago

Hello, were these suggestions able to resolve your issue, or do you still need help? If not, I will go ahead and close it for you