Upload to File drop via curl

I was just spending a lot of time researching how to upload to a File drop via curl.

Let’s suppose your public file drop link looks like this:
https://testcloud.example.com/owncloud/index.php/s/MYFANCYCODE

The following curl command should do the trick:
curl -u "MYFANCYCODE:" -T myupload.md "https://testcloud.example.com/owncloud/public.php/webdav/myupload.md"

Note: make sure that the user name is followed by a colon in -u "MYFANCYCODE:"

Hope this is useful for others looking for that

Cheers

Martin

3 Likes

Hello Martin,

I am glad that you figured something out and want to share it with the community. We depend on people like you :slight_smile:

We have a whole documentation with stuff like this. The command you found is already documented in our user manual. I must admit it’s hidden. You only find it if you are really sure it’s there and you know the path. It took me a while to find it.

Uploading Files to a Public Link Using cURL
To upload a file "file.txt" to a public link with token "70mX9s7KOZwfmdi" (https://example.com/s/70mX9s7KOZwfmdi; no password):

curl -k -T file.txt \
-u "70mX9s7KOZwfmdi:" \
-H 'X-Requested-With: XMLHttpRequest' \
https://example.com/public.php/webdav/file.txt

Maybe you could open an Issue at the docs repo so that we could somehow improve the visibility of this entry so people like you would simply find the command instead of spending time re-event the wheel :slight_smile:

2 Likes