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.
The header output from curl
is gets printed to standard error. So you have to use redirection, for example grepping out the Content-Length
header:
curl -v google.com 2>&1 | grep -vi content-length
Best Answer
Please be more specific what is the purpose of the command. I guess you want to use
to prevent the progress indication and other stuff. -s will perform the same action but silently
If you absolutely have to use >/dev/null 2>&1 i think i would redirect curl output to the file