post-file with PHP back end?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi -- I'm trying to get post-file working with wget (1.9.1), talking to Apache 2.0.48, using PHP 4.3.4. This is all running on an x86 Linux machine with Mandrake 10. If I do an http post of a file through an HTML form (fill in the blanks with a browser, hit submit), the PHP script catches all the data and files, and everything is cool. When I use wget, however, the file does not seem to make it there; I'm sure I'm doing something incorrectly--the man page is a bit vague on post-file. The command I think should work with wget is % wget -O foo.html --post-file data.txt --post-data varname=worksfine http://localhost/test.php The PHP script gets the post-data info correctly, but there's nothing listed in the files portion. The PHP arrays for _FILES or HTTP_POST_FILES are blank when I use wget. It's not clear to me if wget is not uploading the file, or if PHP isn't figuring out where the file is. If someone could shed some light on this, I'd very much appreciate the help. I'm trying to build an automated way to upload experimental results generated on a bunch of distributed machines onto a centralized repository. Best regards, Patrick - -- Prof. Patrick H. Madden [EMAIL PROTECTED] U. Kitakyushu (Japan) and SUNY Binghamton CSD -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCEbxowuzCbpRVKEIRArv0AKDGmD0ugtY7fKntea2MbNmFzlgF6QCfQ+hF MVuetVSj+OdUo+VUG+AxnvA= =k1Ow -END PGP SIGNATURE-
Re: post-file with PHP back end?
On Tue, 15 Feb 2005, Patrick H. Madden wrote: Hi -- I'm trying to get post-file working with wget (1.9.1), talking to Apache 2.0.48, using PHP 4.3.4. This is all running on an x86 Linux machine with Mandrake 10. If I do an http post of a file through an HTML form (fill in the blanks with a browser, hit submit), the PHP script catches all the data and files, and everything is cool. When I use wget, however, the file does not seem to make it there; I'm sure I'm doing something incorrectly--the man page is a bit vague on post-file. The command I think should work with wget is % wget -O foo.html --post-file data.txt --post-data varname=worksfine http://localhost/test.php Is the PHP script possibly assuming that the post data is sent using formpost multipart encoding? Can you show us what the HTML form tag looks like that you use for a browser to do this? -- -=- Daniel Stenberg -=- http://daniel.haxx.se -=- ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Re: post-file with PHP back end?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Here's a subset of the HTML that works with the PHP back end. The actual HTML page is at http://vlsicad.cs.binghamton.edu/placebench. This is for uploading circuit layout information, and benchmarking. - - form method="post" enctype="multipart/form-data" action="autopost.php" Your name: input type="text" name="name"br Email addr: input type="text" name="email"br URL for more information: input type="text" name="url"br Bookshelf PL: input type="file" name="plfile"br input type="submit" value="Submit" /form - -- If the PHP script has the following - - ?php printf("FILESbr"); print_r($_FILES); printf("br"); ? - --- I see the files listed as expected if things come from the HTML, but nothing is there for the wget. I'm not tied to doing it in any specific manner; anything that works would be great. I need to upload one file (potentially a few hundred megabytes), plus some short strings with details on where the run was done, the tool used, version numbers, and so on. Thanks again for the help! On Tuesday 15 February 2005 06:28 pm, you wrote: On Tue, 15 Feb 2005, Patrick H. Madden wrote: Hi -- I'm trying to get post-file working with wget (1.9.1), talking to Apache 2.0.48, using PHP 4.3.4. This is all running on an x86 Linux machine with Mandrake 10. If I do an http post of a file through an HTML form (fill in the blanks with a browser, hit submit), the PHP script catches all the data and files, and everything is cool. When I use wget, however, the file does not seem to make it there; I'm sure I'm doing something incorrectly--the man page is a bit vague on post-file. The command I think should work with wget is % wget -O foo.html --post-file data.txt --post-data "varname=worksfine" http://localhost/test.php Is the PHP script possibly assuming that the post data is sent using formpost multipart encoding? Can you show us what the HTML form tag looks like that you use for a browser to do this? Best regards, Patrick - -- Prof. Patrick H. Madden [EMAIL PROTECTED] U. Kitakyushu (Japan) and SUNY Binghamton CSD -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCEd/NwuzCbpRVKEIRAkpZAKDKiXwFEK3CH0yBCGX4NO5utvgRNwCdHBCh DjcG106Ui+zswW33UFYxyzU= =JMx4 -END PGP SIGNATURE-
Re: post-file with PHP back end?
On Tue, 15 Feb 2005, Patrick H. Madden wrote: Here's a subset of the HTML that works with the PHP back end. The actual HTML page is at http://vlsicad.cs.binghamton.edu/placebench. This is for uploading circuit layout information, and benchmarking. form method=post enctype=multipart/form-data action=autopost.php This form expects the user-agent to provide the POST data MIME-encoded as RFC1867 describes. AFAIK, wget does not provide that feature. If you want to use wget for this, you need to produce a RFC1867-formatted file first and then post that (you'd also need to provide a custom header that specifies the boundary separator string). Another option is to use a tool that already has support for what you're asking. -- -=- Daniel Stenberg -=- http://daniel.haxx.se -=- ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol