curlconsolewgetowncloud

How can I upload files into shared b2drop.eudat(owncloud) repository using curl?


Following link: https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7 holds the files and folders (publicly accessible). Please not that no user name and password is required.

I can download the zip file via:

wget https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7/download

This will generate a download file. I can unzip it via: unzip download

On the website's GUI, when I click plus sign and than upload sign it opens a section where I can select which files I want to download. I would like to do all this operations via console.

enter image description here enter image description here

[Q] From its GUI I could also upload files. Is it possible to upload files using console using curl or wget?

Following command did not help.

curl --upload-file run.sh https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7/

I have also tried from following link: https://github.com/owncloud/pyocclient but it did not helped.

oc = owncloud.Client('https://b2drop.eudat.eu/')
oc.login('username@domain.edu', password )
oc.put_file("https:/b2drop.eudat.eu/s/DfQlm5J42nEGnH7", "path/to/upload/run.sh")
oc.put_file("/s/DfQlm5J42nEGnH7", "path/to/upload/run.sh")
oc.put_file("/DfQlm5J42nEGnH7", "path/to/upload/run.sh")

Thank you for your valuable time and help.


Solution

  • From the analysis of network log, this is a PUT request to https://b2drop.eudat.eu/public.php/webdav/<filename> with text/plain content-type with a basic authentication with no password and username DfQlm5J42nEGnH7.

    The following will upload the local file run.sh :

    curl -X PUT -H 'Content-Type: text/plain' \
         -H 'Authorization: Basic RGZRbG01SjQybkVHbkg3Og==' \
         --data-binary '@run.sh' \
         https://b2drop.eudat.eu/public.php/webdav/run.sh
    

    Note that basic authentication base64 encoded string gives DfQlm5J42nEGnH7: decoded (username:password)

    Original network log :

    enter image description here