rfc:session_upload_progress

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:session_upload_progress [2008/09/08 10:08] – typo lbarnaudrfc:session_upload_progress [2010/01/08 21:11] – external edit 127.0.0.1
Line 3: Line 3:
   * Date: 2008-09-08   * Date: 2008-09-08
   * Author: Arnaud Le Blanc <arnaud.lb@gmail.com>   * Author: Arnaud Le Blanc <arnaud.lb@gmail.com>
-  * Status: Under Discussion+  * Status: Implemented (PHP ≥ 6.0)
   * First Published at: http://wiki.php.net/rfc/session_upload_progress   * First Published at: http://wiki.php.net/rfc/session_upload_progress
   * Patch: http://arnaud.lb.s3.amazonaws.com/session_upload_progress.patch   * Patch: http://arnaud.lb.s3.amazonaws.com/session_upload_progress.patch
Line 20: Line 20:
 Using the session extension for this purpose also allows to use the different storage backends available. Using the session extension for this purpose also allows to use the different storage backends available.
  
-The patch comes with ini settings, working just like APC's ones:+The patch comes with some ini settings, working just like APC's ones:
  
   * session.upload_progress.enabled[=1]   * session.upload_progress.enabled[=1]
Line 26: Line 26:
   * session.upload_progress.name[=PHP_SESSION_UPLOAD_PROGRESS]   * session.upload_progress.name[=PHP_SESSION_UPLOAD_PROGRESS]
   * session.upload_progress.freq[=1%]   * session.upload_progress.freq[=1%]
 +  * session.upload_progress.min_freq[=0.0]
  
 When session.upload_progress.enabled is set to 1, and $_POST[session.upload_progress.name] is set and non-empty, upload informations are stored in $_SESSION[session.upload_progress.prefix . $_POST[session.upload_progress.name]]. When session.upload_progress.enabled is set to 1, and $_POST[session.upload_progress.name] is set and non-empty, upload informations are stored in $_SESSION[session.upload_progress.prefix . $_POST[session.upload_progress.name]].
Line 31: Line 32:
 $_POST[session.upload_progress.name] allows to follow multiple uploading-requests on the same session at the same time. Nothing will be done if it is not set or empty, so that session.upload_progress.enabled can be left to 1 without overhead (also, the upload hook is never called on non multipart/form-data requests). $_POST[session.upload_progress.name] allows to follow multiple uploading-requests on the same session at the same time. Nothing will be done if it is not set or empty, so that session.upload_progress.enabled can be left to 1 without overhead (also, the upload hook is never called on non multipart/form-data requests).
  
-The session.upload_progress.freq setting controls how often the session data will be updated. This can be given in bytes or in percentage of the size of the POST content length. With a reasonable amount, the patch will have mostly no overhead.+The session.upload_progress.prefix is used to avoid conflicts with existing session vars. 
 + 
 +The session.upload_progress.freq and session.upload_progress.min_freq settings control how often the session data will be updated. freq can be given in bytes (e.g. 100) or in percentage (e.g. 1%) of the size of the POST content length. min_freq is given in seconds (e.g. 0.5) and is the minimum interval between two updates. With a reasonable amount for these two settings, the patch will have mostly no overhead.
  
 The patch also allows to follow multiple files in the same request. Each file will have its own $_FILES-like array with name, tmp_name, error, bytes processed, etc. The patch also allows to follow multiple files in the same request. Each file will have its own $_FILES-like array with name, tmp_name, error, bytes processed, etc.
Line 79: Line 82:
 </code> </code>
  
 +The current patch also allows to cancel an upload by setting the "cancel_upload" key to true in the progress data (e.g. $_SESSION["upload_progress_123"]["cancel_upload"] = true;).
 +
 +Doing so will cancel the currently uploading file, bypass all remaining data (POST variables, uploads, etc). An upload canceled this way will have "error" set to [[http://www.php.net/manual/en/features.file-upload.errors.php|UPLOAD_ERR_EXTENSION]].
  
rfc/session_upload_progress.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1