On 19/10/12 08:57, Paul Wratt wrote:
> wget --post-file=1.jpg --header="Content-Type: image/jpg"
> "http://myserver/upload_file.php";
>
> ... --header="...
>
> Paul

Both of them are equivalent. The problem is not there.

kris, post-file expects the POST payload, not a file. The man page
says it very explicitely:
> --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 parameter
> 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.

You could make a multipart/form-data upload, but you would need an
script for wrapping, plus --header to set the proper Content-type. Also,
the option

--header="Content-Type: image/jpg" you were providing is meaningless, since php 
doesn't know how to parse that mimetype.



Reply via email to