php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60196 Session Upload Progress - doesn't work
Submitted: 2011-11-01 23:34 UTC Modified: 2011-12-17 20:43 UTC
From: martin at psinas dot com Assigned:
Status: Closed Package: Session related
PHP Version: 5.4.0beta2 OS: Ubuntu 10.04 / Apache2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martin at psinas dot com
New email:
PHP Version: OS:

 

 [2011-11-01 23:34 UTC] martin at psinas dot com
Description:
------------
Trying to test this new feature documented here:
http://php.net/manual/en/session.upload-progress.php

Can't seem to get it working.

Test script:
---------------
// form.php
<?php
session_start();
?>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="123" />
<input type="file" name="file1" />
<input type="file" name="file2" />
<input type="submit" />
</form>

// upload.php
<?php
session_start();
var_dump($_SESSION);
?>

Expected result:
----------------
I expect the following session values to be populated:

<?php
$_SESSION["upload_progress_123"] = array(
 "start_time" => 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 <input/> 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,
  ),
 )
);
?>

Actual result:
--------------
I get this:

array(0) {}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-02 03:18 UTC] laruence@php.net
plz use a huge size file to test.
 [2011-11-02 03:18 UTC] laruence@php.net
-Status: Open +Status: Bogus
 [2011-11-02 08:51 UTC] martin at psinas dot com
How do you define "huge"? I've modified the form to contain 8 fields instead of 
2, and in each field I'm uploading the php-5.4.0beta2.tar.gz (13.6 MB * 8). The 
form hangs for a few seconds while loading, then I get the empty array.
 [2011-11-02 18:12 UTC] cataphract@php.net
-Status: Bogus +Status: Open
 [2011-12-17 19:06 UTC] crmalibu at gmail dot com
This seems like expected behavior if session.upload_progress.cleanup = On, which is default. By the time his var_dump() script executes(even with a huge file), the upload is finished, and cleanup has already occurred. 

Even though the setting is documented here
http://www.php.net/manual/en/session.configuration.php#ini.session.upload-progress.cleanup
I feel strongly it needs to be mentioned here too, or you will get swarmed with bogus bug reports soon when this feature goes live.
http://www.php.net/manual/en/session.upload-progress.php
 [2011-12-17 20:43 UTC] martin at psinas dot com
-Status: Open +Status: Closed
 [2011-12-17 20:43 UTC] martin at psinas dot com
I believe my installation was not configured correctly. I re-installed 5.4 
following the instructions of a friend and everything worked.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 17:01:28 2025 UTC