Modified: php/php-src/branches/PHP_5_4/php.ini-development =================================================================== --- php/php-src/branches/PHP_5_4/php.ini-development 2011-08-30 11:08:01 UTC (rev 315769) +++ php/php-src/branches/PHP_5_4/php.ini-development 2011-08-30 11:13:22 UTC (rev 315770) @@ -1561,11 +1561,49 @@ ; http://php.net/url-rewriter.tags url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" -;session.upload_progress.enabled = "1" -;session.upload_progress.cleanup = "1" +; Enable upload procgress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix ;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name ;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq ;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq ;session.upload_progress.min_freq = "1" [MSSQL] Modified: php/php-src/branches/PHP_5_4/php.ini-production =================================================================== --- php/php-src/branches/PHP_5_4/php.ini-production 2011-08-30 11:08:01 UTC (rev 315769) +++ php/php-src/branches/PHP_5_4/php.ini-production 2011-08-30 11:13:22 UTC (rev 315770) @@ -1561,13 +1561,50 @@ ; http://php.net/url-rewriter.tags url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" -;session.upload_progress.enabled = "1" -;session.upload_progress.cleanup = "1" +; Enable upload procgress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix ;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name ;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq ;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq ;session.upload_progress.min_freq = "1" - [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On Modified: php/php-src/trunk/php.ini-development =================================================================== --- php/php-src/trunk/php.ini-development 2011-08-30 11:08:01 UTC (rev 315769) +++ php/php-src/trunk/php.ini-development 2011-08-30 11:13:22 UTC (rev 315770) @@ -1561,11 +1561,49 @@ ; http://php.net/url-rewriter.tags url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" -;session.upload_progress.enabled = "1" -;session.upload_progress.cleanup = "1" +; Enable upload procgress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix ;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name ;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq ;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq ;session.upload_progress.min_freq = "1" [MSSQL] Modified: php/php-src/trunk/php.ini-production =================================================================== --- php/php-src/trunk/php.ini-production 2011-08-30 11:08:01 UTC (rev 315769) +++ php/php-src/trunk/php.ini-production 2011-08-30 11:13:22 UTC (rev 315770) @@ -1561,13 +1561,50 @@ ; http://php.net/url-rewriter.tags url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" -;session.upload_progress.enabled = "1" -;session.upload_progress.cleanup = "1" +; Enable upload procgress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix ;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name ;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq ;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq ;session.upload_progress.min_freq = "1" - [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On Modified: phpdoc/en/trunk/reference/session/book.xml =================================================================== --- phpdoc/en/trunk/reference/session/book.xml 2011-08-30 11:08:01 UTC (rev 315769) +++ phpdoc/en/trunk/reference/session/book.xml 2011-08-30 11:13:22 UTC (rev 315770) @@ -80,6 +80,7 @@ &reference.session.setup; &reference.session.constants; &reference.session.examples; + &reference.session.upload-progress; &reference.session.security; &reference.session.reference; Modified: phpdoc/en/trunk/reference/session/ini.xml =================================================================== --- phpdoc/en/trunk/reference/session/ini.xml 2011-08-30 11:08:01 UTC (rev 315769) +++ phpdoc/en/trunk/reference/session/ini.xml 2011-08-30 11:13:22 UTC (rev 315770) @@ -173,37 +173,37 @@ Available since PHP 4.0.4. - session.upload_progress.enabled + session.upload_progress.enabled "1" PHP_INI_PERDIR Available since PHP 5.4.0. - session.upload_progress.cleanup + session.upload_progress.cleanup "1" PHP_INI_PERDIR Available since PHP 5.4.0. - session.upload_progress.prefix + session.upload_progress.prefix "upload_progress_" PHP_INI_PERDIR Available since PHP 5.4.0. - session.upload_progress.name + session.upload_progress.name "PHP_SESSION_UPLOAD_PROGRESS" PHP_INI_PERDIR Available since PHP 5.4.0. - session.upload_progress.freq + session.upload_progress.freq "1%" PHP_INI_PERDIR Available since PHP 5.4.0. - session.upload_progress.min_freq + session.upload_progress.min_freq "1" PHP_INI_PERDIR Available since PHP 5.4.0. @@ -741,6 +741,106 @@ + + + + session.upload_progress.enabled + boolean + + + + Enables upload progress tracking, populating the $_SESSION variable. + Defaults to 1, enabled. + + + + + + + session.upload_progress.cleanup + boolean + + + + Cleanup the progress information as soon as all POST data has been read + (i.e. upload completed). Defaults to 1, enabled. + + + + It is highly recommended to keep this feature enabled. + + + + + + + + session.upload_progress.prefix + string + + + + A prefix used for the upload progress key in the $_SESSION. + This key will be concatenated with the value of + $_POST[ini_get("session.upload_progress.name")] to + provide a unique index. + + + Defaults to "upload_progress_". + + + + + + + session.upload_progress.name + string + + + + The name of the key to be used in $_SESSION storing + the progress information. See also + session.upload_progress.prefix. + + + If $_POST[ini_get("session.upload_progress.name")] + is not passed available, upload progressing will not be recorded. + + + Defaults to "PHP_SESSION_UPLOAD_PROGRESS". + + + + + + + session.upload_progress.freq + mixed + + + + Defines how often the upload progress information should be updated. + This can be defined in bytes (i.e. "update progress information after every 100 bytes"), or in percentages (i.e. "update progress information after recieving every 1% of the whole filesize). + + + Defaults to "1%". + + + + + + + session.upload_progress.min-freq + integer + + + + The minimum delay between updates, in seconds. + Defaults to "1" (one second). + + + + @@ -753,6 +853,13 @@ stored and restored. + + Upload progress will not be registered unless + session.upload_progress.enabled is enabled, and the + $_POST[ini_get("session.upload_progress.name")] variable is set. + See Session Upload Progress for mor details on this functionality. + + As of PHP 4.0.3, + + + + Session Upload Progress + + + When the + session.upload_progress.enabled + INI option is enabled, PHP will be able to track the upload progress of + individual files being uploaded. + This information isn't particularly useful for the actual upload request + itself, but during the file upload an application can send an POST request + to a seperate endpoint (via XHR for example) to check the + status. + + + The upload progress will be available in the $_SESSION + superglobal when an upload is in progress, and when POSTing a variable of + the same name as the + session.upload_progress.name + INI setting is set to. + When PHP detects such POST requests, it will populate an array in the + $_SESSION, where the index is a concatenated value of the + session.upload_progress.prefix + and + session.upload_progress.name + INI options. + The key is typically retrieved by reading these INI settings, i.e. + + + +]]> + + + + + It is also possible to cancel the currently in-progress file + upload, by setting the $_SESSION[$key]["cancel_upload"] key to + true. + When uploading multiple files in the same request, this will only cancel the + currently in-progress file upload, and pending file uploads, but will not + remove successfully completed uploads. + When a upload is cancelled like this, the error key in + $_FILES array will be set to + UPLOAD_ERR_EXTENSION. + + + The + session.upload_progress.freq + and + session.upload_progress.min_freq + INI options control how frequent the upload progress information should be + recalculated. + With a reasonable amount for these two settings, the overhead of this + feature is almost non-existing + + + + Example information + + Example of the structure of progress upload array. + + + + " value="123" /> + + + + +]]> + + + The data stored in the session will looks like this: + + + 1234567890, // The request time + "content_length" => 57343257, // POST content length + "bytes_processed" => 453489, // Amount of bytes received and processed + "done" => false, // true when the POST handler has finished, successfully or not + "files" => array( + 0 => array( + "field_name" => "file1", // Name of the field + // The following 3 elements equals those in $_FILES + "name" => "foo.avi", + "tmp_name" => "/tmp/phpxxxxxx", + "error" => 0, + "done" => true, // True when the POST handler has finished handling this file + "start_time" => 1234567890, // When this file has started to be processed + "bytes_processed" => 57343250, // Amount of bytes received and processed for this file + ), + // An other file, not finished uploading, in the same request + 1 => array( + "field_name" => "file2", + "name" => "bar.avi", + "tmp_name" => NULL, + "error" => 0, + "done" => false, + "start_time" => 1234567899, + "bytes_processed" => 54554, + ), + ) +); +]]> + + + + + + + + Modified: web/php/trunk/include/errors.inc =================================================================== --- web/php/trunk/include/errors.inc 2011-08-30 11:08:01 UTC (rev 315769) +++ web/php/trunk/include/errors.inc 2011-08-30 11:13:22 UTC (rev 315770) @@ -283,7 +283,13 @@ 'session.cache-expire' => 'session.configuration.php#ini.session.cache-expire', 'session.use-trans-sid' => 'session.configuration.php#ini.session.use-trans-sid', 'session.hash-function' => 'session.configuration.php#ini.session.hash-function', - 'session.hash-bits-per-character'=> 'session.configuration.php#ini.session.hash-bits-per-character', + 'session.hash-bits-per-character' => 'session.configuration.php#ini.session.hash-bits-per-character', + 'session.upload-progress.enabled' => 'session.configuration.php#ini.session.upload-progress.enabled', + 'session.upload-progress.cleanup' => 'session.configuration.php#ini.session.upload-progress.cleanup', + 'session.upload-progress.prefix' => 'session.configuration.php#ini.session.upload-progress.prefix', + 'session.upload-progress.name' => 'session.configuration.php#ini.session.upload-progress.name', + 'session.upload-progress.freq' => 'session.configuration.php#ini.session.upload-progress.freq', + 'session.upload-progress.min-freq' => 'session.configuration.php#ini.session.upload-progress.min-freq', 'url-rewriter.tags' => 'session.configuration.php#ini.url-rewriter.tags', 'assert.active' => 'info.configuration.php#ini.assert.active', 'assert.warning' => 'info.configuration.php#ini.assert.warning',