cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: help with PUT and CURLOPT_READFUNCTION

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Sun, 4 May 2008 18:07:52 -0400

fread(), file_get_contents(), and readfile() all store the data in memory -
there's no real way (AFAIK) of just sending right from disk.
However - something that might work is iteratively using stream_get_contents
(http://ca3.php.net/manual/en/function.stream-get-contents.php). You could
read the file in chunks, then destroy each chunk when you're done reading
it.

-Stephen

On Thu, May 1, 2008 at 5:14 PM, James Goddard <james_goddard0511_at_yahoo.com>
wrote:

> Can anyone who's familiar with the php binding confirm
> that the file being PUT is streamed and not first
> stored in memory? If so, it will help me pin down why
> I can't put files over a certain size without running
> out of memory...
>
> Thanks Daniel.
>
> >> I can successfully PUT a file using CURLOPT_PUT,
> CURLOPT_INFILE, and
> >> CURLOPT_INFILESIZE. However, for large files ( >
> ~100MB) my machine runs out
> >> of memory so I want to be able to "stream" the file
> to the webserver
> >> (instead of storing it in memory and then sending)
> via CURLOPT_READFUNCTION.
>
> > I'm sorry, but I don't buy this explanation. libcurl
> itself only supports HTTP
> > PUT by streaming the upload, and I'm quite sure the
> PHP layer doesn't add any
> > major magic to that. Thus, the size of the PUT
> upload has no relevance, it
> > always takes roughly the same amount of memory!
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-05-05