0

I have noticed that my application on Ubuntu 18 is not uploading files to remote server which was working ok on Ubuntu 16.

When I do trace I see only one difference.

Ubuntu 16: Content-Disposition: form-data

Ubuntu 18: Content-Disposition: attachment

Curl command:

curl --trace-ascii - -XPOST -u user:password  -H 'Content-Type: multipart/mixed' \
    -H 'If-Match: '"e4a49f13"'' -F 'file-delete={"delete":[]};type=application/json' \
    -F 'file-put-1=@test.txt;filename=destinationFile.txt;type=text/plain' \
    'http://192.168.1.20:8081/applications/14837348?content=RAW'

Versions: Ubuntu 16: curl 7.47.0 Ubuntu 18: curl 7.58.0

I have tried also to install from source https://github.com/curl/curl.git

Found this reported issue: https://github.com/curl/curl/issues/5256

Thank you all for help

  • Why did you override the Content-Type? That is probably the problem. – Michael Hampton Jun 30 at 5:15
  • @MichaelHampton but why is working on ubuntu 16? – iWizard Jun 30 at 5:37
  • Who knows? Maybe the old version ignored your attempt to override the header, and the new version doesn't. Maybe it was a bug that they fixed. Maybe I'm completely wrong and the problem lies elsewhere. But you can at least try it and find out whether it works. – Michael Hampton Jul 1 at 15:01
  • @MichaelHampton it works if I remove Content-Type :) – iWizard Jul 2 at 5:26
0

Can try the following command to upload file to a remote server provided the necessary authentication is assigned

curl -F ‘data=local file path’ Destination address

Same -F option can be provided to upload multiple files.

try this, if not working let me know

| improve this answer | |

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.