2

When uploading a file with curl's --upload-file option, how do I specify a file name different than the one on disk? With the -F option, it can be done like this, I think: curl -F 'file=@/path/to/file/badname;filename=goodname', but I'm not sure how to do the equivalent with --upload-file (also -T). I am using an API which requires an uploaded file to have a certain filename, but I don't want to copy the file on-disk just so I can upload it properly.

1

Use curl’s --url option like this:

curl --upload-file /path/to/file/badname --url http://serverip/remotedir/goodname
  • This doesn't work – Yuval Adam Jun 27 '18 at 7:42
0

curl -v --user 'username:password' --upload-file {path}/{binaire} {your_url}/{binaire}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.