On 01/26/2011 08:01 AM, Kaplan, Murad wrote:
> Hello,
> I am using wget and I have a question about the -post-data option.
> Can I use it to POST data to another server. Like, can I use it so upload 
> .jpg or .DOC files?
> For example wget -post-file=file-1.jpg http://server.com/files

No, sorry. See recent versions of the manual (where this has been
clarified a little better than some of the preceding version).

       --post-file=file
           Use POST as the method for all HTTP requests and send
           the specified data in the request body.  --post-data
           sends string as data, whereas --post-file sends the
           contents of file.  Other than that, they work in
           exactly the same way. In particular, they both expect
           content of the form "key1=value1&key2=value2", with
           percent-encoding for special characters; the only
           difference is that one expects its content as a
           command-line paramter and the other accepts its content
           from a file. In particular, --post-file is not for
           transmitting files as form attachments: those must
           appear as "key=value" data (with appropriate percent-
           coding) just like everything else. Wget does not
           currently support "multipart/form-data" for
           transmitting POST data; only
           "application/x-www-form-urlencoded". Only one of
           --post-data and --post-file should be specified.


-- 
HTH,
Micah J. Cowan
http://micah.cowan.name/

Reply via email to