post-file does not work with post-data
Dear Wget I am trying to use wget with a site that uploads a file and copies it to the specified subdirectory but the file is not included in the post. The command used is as follows: wget --post-data=directory=images --post-file=image1.jpg --http-user=admin --http-password=password http://example.atltelecom.com The upload works ok when performed from a form in a browser so it appears to be a wget problem Best Regards Nick Nick Lewis Technical Sales Engineer atl telecom Lakeside, Fountain Lane, St Mellons Cardiff, CF3 0FB, UK DDI: +44 (0)29 2050 0718 Mob: +44 (0)7973 634707 Office: +44 (0)29 2050 0700 Fax: +44 (0)29 2050 0701 http://www.atltelecom.com/ www.atltelecom.com _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. _ Disclaimer of Liability ATL Telecom Ltd shall not be held liable for any improper or incorrect use of the information described and/or contained herein and assumes no responsibility for anyones use of the information. In no event shall ATL Telecom Ltd be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement or substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this system, even if advised of the possibility of such damage. Registered Office: ATL Telecom Ltd, Fountain Lane, St. Mellons Cardiff, CF3 0FB Registered in Wales Number 4335781 All goods and services supplied by ATL Telecom Ltd are supplied subject to ATL Telecom Ltd standard terms and conditions, available upon request.
Re: post-file does not work with post-data
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Nick Lewis wrote: Dear Wget I am trying to use wget with a site that uploads a file and copies it to the specified subdirectory but the file is not included in the post. The command used is as follows: wget --post-data=directory=images --post-file=image1.jpg --http-user=admin --http-password=password http://example.atltelecom.com The upload works ok when performed from a form in a browser so it appears to be a wget problem Actually, --post-file and --post-data are not intended to be used together; they both provide exactly the same functionality, which is to specify what the POST request's body content should be--in its entirety. Also, --post-file isn't intended to be used in the manner you are using it; it is meant to specify a file whose contents are in the form key=valuekey2=value2 This could have been made clearer in the documentation. If --post-file did work the way you are trying to use it, you'd still need some way to specify what the name of the file upload control was (as it appears in the HTML form). Of the two Content-Types available (application/x-www-form-urlencoded and multipart/form-data), wget currently supports only application/x-www-form-urlencoded. For submitting actual files as form content, multipart/form-data is a much more natural mechanism. You could probably still do it with application/x-www-form-urlencoded, but it would require you to translate the file contents yourself into a percent-encoded form, and place the contents as directory=imagesfile=url-encoded-file-contents. Obviously, while this is something wget does not currently do, it is something wget ought to do. I'll look into how we might implement this in a future version. - -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFGhNCe7M8hyUobTrERCF9iAJ9w+CK/k/CKOqIbEfNSuijL+leMugCY5gnV G3pT2qz6r6qWuBGKvZ9J9A== =dKVf -END PGP SIGNATURE-
Re: post-file does not work with post-data
On Fri, 29 Jun 2007, Micah Cowan wrote: For submitting actual files as form content, multipart/form-data is a much more natural mechanism. [...] Obviously, while this is something wget does not currently do, it is something wget ought to do. I'll look into how we might implement this in a future version. Allow me to mention that (lib)curl supports this and this could serve as inspiration for a future wget implementation.