# Upload file to shared folder using wget

**URL:** <https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752>\
**Category:** 🏷️ General\
**Created:** [March 22, 2020, 10:11am UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752 "2020-03-22T10:11:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maddox](https://help.nextcloud.com/letter_avatar/maddox/32/6_22734026db12803ebb3e059622ac3534.png) [@maddox](https://help.nextcloud.com/u/maddox)\
**Post date:** [March 22, 2020, 10:11am UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752/1 "2020-03-22T10:11:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [March 22, 2020, 10:17am UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752/2 "2020-03-22T10:17:26Z")

</div>

w **get** - is used to fetch data from a server.  
w **put** - 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:

> <https://superuser.com/questions/130009/how-can-i-do-a-http-put-with-wget>

---

<div class="post-metadata">

**Author:** ![maddox](https://help.nextcloud.com/letter_avatar/maddox/32/6_22734026db12803ebb3e059622ac3534.png) [@maddox](https://help.nextcloud.com/u/maddox)\
**Post date:** [March 22, 2020, 10:42am UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752/3 "2020-03-22T10:42:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [March 22, 2020, 1:37pm UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752/4 "2020-03-22T13:37:57Z")

</div>

> [@maddox](#):
>
> I’m no web server expert so I need a working example

But you’re able to use the search function of this forum, aren’t you? 😉

> [@Upload to "File Drop" using curl from command line](https://help.nextcloud.com/t/upload-to-file-drop-using-curl-from-command-line/11893):
>
> 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…

> [@Uploading to a public link via a script?](https://help.nextcloud.com/t/uploading-to-a-public-link-via-a-script/20294/5):
>
> 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…

> [@How to upload a file via CLI to Nextcloud? (bash)](https://help.nextcloud.com/t/how-to-upload-a-file-via-cli-to-nextcloud-bash/71837/2):
>
> I would use cURL like described in the [documentation](https://docs.nextcloud.com/server/18/user_manual/files/access_webdav.html#accessing-files-using-curl): curl -u USERNAME:PASSWORD -T /path/to/file https://my.nextcloud.com/remote.php/dav/files/USERNAME/

---

<div class="post-metadata">

**Author:** ![Geo34980](https://help.nextcloud.com/letter_avatar/geo34980/32/6_22734026db12803ebb3e059622ac3534.png) [@Geo34980](https://help.nextcloud.com/u/Geo34980)\
**Post date:** [May 4, 2021, 10:43pm UTC](https://help.nextcloud.com/t/upload-file-to-shared-folder-using-wget/74752/5 "2021-05-04T22:43:47Z")

</div>

It did work for me. Thanks
