Search code examples
uploadcurl

How to upload files to password protected HTTPS site using CURL?


How can I upload files to a HTTPS site using CURL?

The site is also password protected.

What's the command line used to upload for that particular site?


Solution

  • Yes, you can,

    $ curl --user login:password --upload-file your.file.txt https://the.url/where/that/should/go
    

    You may need to add --insecure if you don't want cURL to check the certificate chain.

    Use single or double quotations if your password contains special characters.

    $ curl --user admin:'some%pass~' --upload-file your.file.txt https://the.url/where/that/should/go