Patch for File-uploads with HTTP_Request
| From: | Christian Stocker | Date: | Tue, 18 Mar 2003 14:48:25 +0000 |
| Subject: | Patch for File-uploads with HTTP_Request | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-14396@lists.php.net to get a copy of this message | ||
Hi
I extended today HTTP_Request for adding files into POST-Data (therefore
emulating <input type="file">). You can find the diff at:
http://trash.chregu.tv/HTTP_Request.diff
A very simple example:
include("HTTP/Request.php");
$a = &new HTTP_Request('http://example.com/');
$a->addHeader("Content-Type","multipart/form-data");
$a->addFile("image","/home/chregu/tmp/lisa.jpg","image/jpeg");
$a->sendRequest();
Hope that helps anyone and if it's not that bad, gets included into CVS
(I can commit it, but I'd like to have the ok of the maintainer first ;)
)
chregu
--
christian stocker | bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid
0x5CE1DECB