Reputation: 34924
I'm trying to upload a file to a server using curl. It should be uploaded a binary file regardless the format it is in. But I'm having an error:
curl -d @/home/alex/123.log localhost:9000/myupload/
The error (the warning, actually) is
Warning: Couldn't read data from file "123.log", this makes an empty POST.
P.S. Shouldn't I use --data-binary
instead of -d
? I didn't find any documentation for --data-binary
.
Upvotes: 0
Views: 5151
Reputation: 39385
Copied from Curl's document:
-d, --data is the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode the value of a form field you may use --data-urlencode.
More about the --data-binary parameter.
Note: Make sure you have permission to access the file that you wanted to upload to the sever.
Upvotes: 1