Q: How should I handle file upload?
A: File uploading requires HTML form of content type
"multipart/form-data". The file content has to be POSTed/submitted via
the form and once the file is uploaded, it will be available at the
"upload_tmp_dir" (usually /tmp) directory. Then you may move that file
to another directory using move_uploaded_file(); file name will be
available in the superglobal $_FILES['userfile']['tmp_name'].
Refer:
http://www.php.net/features.file-upload
http://www.faqs.org/rfcs/rfc1867.html
Q: How to upload a huge file to the server?
A: Uploading depends on various factors:
1. Browser timeout/capacity/configuration
2. Available space and memory at the server
3. PHP's setting to handle uploads and POST data
In most of the cases, you could be able to adjust only the (3)
Refer:
http://www.php.net/ini.core#ini.sect.file-uploads
Q: How to implement progress/status bar for file uploading?
A: This is impossible in PHP as it doesn't populate HTTP_RAW_POST_DATA
natively. Anyway, there are few hacks available:
1. Patching PHP <http://pdoru.from.ro/upload-progress-meter/>
2. Using Perl <http://www.raditha.com/php/progress.php>
3. Finding the size of "upload_tmp_dir" directory at some interval,
originally suggested by Reader Ron in
<news:42**************************@posting.google. com>
Caveats:
There is no speculation that patching solution will be implemented
natively in PHP.
(3) seems to be the only pure PHP hack; however it won't work when
multiple files are been uploaded at the same time.