Re: Uploading large files with HTTP_Request class

From: Date: Thu, 31 May 2012 20:09:39 +0000
Subject: Re: Uploading large files with HTTP_Request class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-318062@lists.php.net to get a copy of this message
On Thu, May 31, 2012 at 5:28 AM, Voß, Marko <Marko.Voss@fiz-karlsruhe.de> wrote: > Hello, > > I need to perform uploading of large files using the HTTP_Request class: > > http://pear.php.net/manual/package.http.http-request.php > > I am *not* using this one: > > http://php.net/manual/en/class.httprequest.php > > > The HTTP_Request class support the following functions: > > setBody() and addFile() > > The addFile()-function however simulates a form field and the server application does not read > the incoming file from such a field. I have to put the file content as a stream through the body. > > Adding the file content using the setBody()-function will of course cause an out of memory > error: > > $fp = fopen($filename, 'r'); > $request->setBody(fread($fp, $filesize($filename))); > $fclose($fp); > $response = $request->sendRequest(); > > > How am I supposed to do that with this class? Are there any alternatives, which do not force me > to add new PHP dependancies/libraries to the project? I am writing a library and do not want to > force the users to add dependancies to their projects in order to use this library. > > I am currently using PHP 5.3.0. > > > Thank you and best regards, > Marko > > > ------------------------------------------------------- > > Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische Information > mbH. > Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 101892. > Geschäftsführerin: Sabine Brünger-Weilandt. > Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Does the receiving server only accept uploads via HTTP? Or is there another protocol you could use? I'm not aware of anyway via HTTP you can send "chunks" up; as far as I know, that only works for server->client transfers.

« previous php.general (#318062) next »