Skip to content

Instantly share code, notes, and snippets.

@spyesx
Created September 14, 2020 07:52
Show Gist options
  • Save spyesx/e279a43725989e8adc02526216c02226 to your computer and use it in GitHub Desktop.
Save spyesx/e279a43725989e8adc02526216c02226 to your computer and use it in GitHub Desktop.
Upload a file to Nextcloud with curl
# source: https://docs.nextcloud.com/server/19/user_manual/files/access_webdav.html#accessing-files-using-curl
curl -u USERNAME:PASSWORD -T /path/to/file https://my.nextcloud.tld/remote.php/dav/files/USERNAME/path/to/directory/
@MexHigh
Copy link

MexHigh commented Jun 26, 2024

Nice!

@Natutechbi
Copy link

need able webdav in apache!

@Toufa7
Copy link

Toufa7 commented May 6, 2025

I'm getting the following error when trying to upload a file to my self-hosted Nextcloud using curl:

<s:message>PUT is not allowed on non-files.</s:message>

I solved it by adding the following header to the curl command:

-H "X-Requested-With: XMLHttpRequest" 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment