NYCPHP Meetup

NYPHP.org

[nycphp-talk] status of large file uploads

Corey Szopinski corey at domanistudios.com
Wed Dec 14 19:10:36 EST 2005


I'm trying to build a simple AJAX file upload progress bar. I'm  
running into some trouble getting access to the file information that  
I need.

I've seen a couple of different strategies for tackling this problem.

1. patching PHP so that it has a callback handler in the file upload  
methods
http://pdoru.from.ro/

2. Watching the tmp upload directory for file size updates
http://lixlpixel.org/ajax-upload-progress/
http://www.devpro.it/upload_progress/

3. Using a perl cgi-script to monitor the files
http://sourceforge.net/projects/megaupload/


I don't like option #1 because I don't want to have to patch my  
installation of php. I don't mind #2, but I need to support  
concurrent uploads, so this one is out of the running. I'm also loath  
to use #3, because I'm not a huge fan of perl, and it seems like PHP  
should be able to handle it.

A further frustration is that the $_FILES array seems to populate  
_after_ the file is finished uploading. I had hoped to grab the $_FILE 
['tmp_name'] early, and then monitor the file via filesystem calls. I  
had also kicked around using ini_set('tmp_upload_dir') to a dynamic  
folder and then scanning over that folder like option #2, but the  
ini_set would apply to all uploads, and not just the one I want to  
monitor (which means no concurrent uploads).

Are there any other sneaky ways to either 1. get (or set) the  
tmp_name of a file so it can be watched, or 2. another means entirely  
of watching the progress.

Any help would be appreciated.

thanks,

-corey



More information about the talk mailing list