Re: Processing the file as its being uploaded
| From: | Camilo Sperberg | Date: | Thu, 28 Nov 2013 19:49:01 +0000 |
| Subject: | Re: Processing the file as its being uploaded | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322529@lists.php.net to get a copy of this message | ||
On 28 nov. 2013, at 20:11, Marcelo Taube <marcelo@nivelmedia.com> wrote:
> Hello,
> I want to write a php script which process a file being upload to the
> server, to check contentes and stores it on the fly, as its being uploaded.
> My goal is to avoid using the memory needed to hold the whole file, and
> instead just upload it and forgetting the parts already processed.
> I have seen that this "streaming" interface of file uploads exist for HTTP
> PUT method but could not find info on how to do it using POST.
> So, is there any way of configuring PHP or APACHE to provide uploaded files
> using POST in a streaming fashion?
> If this is not possible, is it because an instrinsic limit of the HTTP
> protocol? a limit on the apache architecture? or a design decision in PHP?
> And last, in PUT method, are I warrantied that the input in stdin comes
> directly to the PHP script or should i expect apache to pre buffer the
> whole file and then just start to send it?
>
> Thank you
We had recently a look into plupload which enables the upload (via JavaScript) of chunks of data,
which, when completed are just joined together (PHP's side). It enables you to not increase
memory usage because of one large upload.
You can find demos and documentation on their github repo:
https://github.com/moxiecode/plupload
It hasn't made it into production yet but on our tests it works pretty well, IE11 has a few
problems, but there is a fix for that which should make it into the next stable version.
https://github.com/moxiecode/plupload/issues/906
Some more information about chunking and plupload:
https://github.com/moxiecode/plupload/wiki/Frequently-Asked-Questions#wiki-when-to-use-chunking-and-when-not
Greetings.
Met vriendelijke groet,
Camilo Sperberg
----------------
W: http://unreal4u.com
T: http://twitter.com/unreal4u