I am trying to use curl command to upload a text file to my cloud. I have the upload link where I want to upload the file. The command curl --upload-file path/of/file/here https://upload.address.here just throws a lot of HTML code on my screen but does not upload the file .

Is there any other way I can upload a file, using terminal.

  • 1
    where is the header? the authentication? Btw: the "lot of html code" also tells you why it is not working ;) – Rinzwind Sep 3 '19 at 18:54
  • There are many, many ways to upload a file using the terminal. However, they require you to have a login account (of some sort) on the remote machine. – user535733 Sep 3 '19 at 19:14

If you're referring to uploading a file using a web form, you have to know what the web end-point is (i.e. the part that is processing the form).

The fact that you're getting a webpage indicates that you are trying to upload a file to a form. Without additional information, it would be next to impossible to help due to the sheer number of possibilities of how this can be implemented in the back end.

If you are uploading a file to a server that you do not control, it's best to get in touch with the web developer/host to find out if there is an API that you can use to upload files. The API end-point can then be used by curl to send the file.

If this is a server you do control, I would recommend either scp, sftp, or ftp to upload the file instead of going through a form.

| 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.