I looked at it in with Fiddler and the problem is that Chrome erases the file content from the curl request it generates. So you have to insert it back in.
I got it to work with http://www.zippyshare.com/.
Here was the curl request Chrome generated
curl "http://www72.zippyshare.com/upload" -H "Origin: http://www.zippyshare.com" -H "Accept-Encoding: gzip,deflate,sdch" -H "Accept-Language: en-US,en;q=0.8" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36" -H "Content-Type: multipart/form-data; boundary=----------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7" -H "Accept: */*" -H "Referer: http://www.zippyshare.com/" -H "Cookie: __utma=46003887.80665104.1404275690.1404275690.1404275690.1; __utmb=46003887.1.10.1404275690; __utmc=46003887; __utmz=46003887.1404275690.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not"%"20provided); ziplocale=en" -H "Proxy-Connection: keep-alive" --data-binary '------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="Filename"
Giant_Panda_Tai_Shan.jpg
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="uploadify"
true
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="embPlayerValues"
null
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="Filedata"; filename="Giant_Panda_Tai_Shan.jpg"
Content-Type: application/octet-stream
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="Upload"
Submit Query
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7--' --compressed
I divided the data into two pieces where the file was.
Part 1:
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="Filename"
Giant_Panda_Tai_Shan.jpg
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="uploadify"
true
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="embPlayerValues"
null
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7
Content-Disposition: form-data; name="Filedata"; filename="Giant_Panda_Tai_Shan.jpg"
Content-Type: application/octet-stream
.
(That . wasn't at the end, I added it just now to get the code block to recognize there are two blank lines at the end of the file.)
Part 2:
.
Submit Query
------------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7--
(Again with the .)
Also you need to make sure the files are in CRLF format.
Now you can run
cat part1.txt Giant_Panda_Tai_Shan.jpg part2.txt > complete
Then to run it
curl "http://www72.zippyshare.com/upload" -H "Referer: http://www.zippyshare.com/" -H "Origin: http://www.zippyshare.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36" -H "Content-Type: multipart/form-data; boundary=----------KM7cH2GI3Ef1gL6GI3ei4Ef1Ij5KM7" --data-binary @complete --compressed
It runs (takes a few seconds to upload) and returns html confirming the successful upload.
While you might technically be doing a "POST" request in fiddler (Which I've not used, but I do know a thing or two about HTTP), it looks to me very much like you are not actually posting your query, rather you are using a "PUT" (presumably combined with an empty post).
I believe that if you were to use curl http://localhost:49301/api/donut/run?Task=bake it would work fine.
[ A PUT request puts the parameters as part of the URL, a POST request instead puts them in the request header.
Its probable that your application is programmed to accept PUTS but not POSTS.
Best Answer
You can't use
-F
and-d
together, since they use different content types, and you needmultipart/form-data
. So try with:From
man curl
: