Uploading files through API

php72
nextcloud
#1

(Using Nextcloud 15)

Hi. We want to create a script that use the NextCloud API to upload a file. Right now we’ve tried using the API at:
https://docs.nextcloud.com/server/15/developer_manual/client_apis/WebDAV/basic.html#uploading-files

This let us upload files such as .txt by having the script take the content of the file and use that content in the raw body of the curl request. However this doesn’t seem to work as good with other file types (for example .pdf).

Is there another API call for uploading files to Nextcloud? Or any other alternative ways?

0 Likes

#2

You could upload files with cURL using WebDAV:
https://docs.nextcloud.com/server/latest/user_manual/files/access_webdav.html#accessing-files-using-curl

0 Likes