maddox
March 22, 2020, 10:11am
1
I created a shared folder with the settings upload only.
I want to upload files to this shared folder via wget.
I tried the following command without success:
wget --header=“Content-type: multipart/form-data boundary=FILEUPLOAD” --post-file filetoupload https://[server]/index.php/s/[share-ID]
Any ideas
j-ed
March 22, 2020, 10:17am
2
wget - is used to fetch data from a server.
wput - is used to send data to a server.
If you stick to wget, you can use the --method=PUT option, or use wput or curl instead:
maddox
March 22, 2020, 10:42am
3
Sorry but this doesn’t help
Even switching to curl only produces 405 Errors. It seems I need some option. Maybe a header field. I’m no web server expert so I need a working example
j-ed
March 22, 2020, 1:37pm
4
But you’re able to use the search function of this forum, aren’t you?
Nextcloud version (eg, 10.0.2): 11
Operating system and version (eg, Ubuntu 16.04): 16.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.18
PHP version (eg, 5.6): 7.0.15
Is it possible to upload to a Nextcloud “File Drop” using curl from a command line? I have tried:
curl -T fileToUpload https://nextcloud.mysite.com/s/gL8JS945tRZbGZF
curl -X PUT https://nextcloud.mysite.com/s/gL8JS945tRZbGZF --data-binary @"/tmp/test"
And I have even gone in to Chrome’s developer console, watched a samp…
I managed to succeed in uploading files through my own custom script by adding the “X-Request-With” header. This makes the final curl command something like:
curl -k -T testfile.txt -u "AtAxVrKorgC5YJf:" -H 'X-Requested-With: XMLHttpRequest' https://nextcloud.example.com/public.php/webdav/testfile.txt
-u is the parameter for the “Authorization: Basic” header where the username is the final part of the share link created by nextcloud. This makes sure the file gets uploaded to the correct direct…
I would use cURL like described in the documentation :
curl -u USERNAME:PASSWORD -T /path/to/file https://my.nextcloud.com/remote.php/dav/files/USERNAME/
1 Like
It did work for me. Thanks