PHP Classes

Upload Progress: Track file upload progress

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (4 days ago) RSS 2.0 feedNot enough user ratingsTotal: 711 This week: 4All time: 4,634 This week: 102Up
Version License PHP version Categories
upload-progress 0.1.0GNU General Publi...5.2HTTP, PHP 5, Files and Folders
Description 

Author

This class can be used to track file upload progress.

It can generate an identifier to track that the file upload that should be used in the HTML form as a hidden field.

When the upload form is submitted, PHP can associate the file being uploaded with the generated identifier, so the class can retrieve information of the upload progress in a parallel HTTP request eventually sent via AJAX.

The class uses the PHP upload progress extension which can be configured to keep track of the upload progress using an APC cache entry, PHP session variables or PHP temporary files.

Picture of AlexanderC
  Performance   Level  
Name: AlexanderC <contact>
Classes: 13 packages by
Country: Moldova Moldova
Innovation award
Innovation award
Nominee: 3x

Details

Why? Basicaly because of crossbrowser compatibility. In fact it is supported by any* browser. How to use? $p = new FileUploadProgress("unique_file_description"); // ... insert in upload form before file field echo $p->getHiddenUploadFieldHTML(); // and now get upload progress info $arrayWithThings = $p->getProgress(); // this will throw an exception if no/wrong data Please note!!! File upload track should be done using ajax or frames, php script with file data(from $_FILES) will be available after upload only, and this class make no sense if used in that script. What to install before to get it working? - To enable upload track support install and configure apc: apc.rfc1867 = 1 - Or to install uploadprogress PHP extension - Or to install PHP 5.4< and set: session.upload_progress.enabled = 1 ;set by default here

  Files folder image Files  
File Role Description
Plain text file FileUploadProgress.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:711
This week:4
All time:4,634
This week:102Up