PhP Upload progress in PhP 5.4 is not working. Session variables not set
There could be some issues, I have listed down few of them.
- The web server's request buffering has to be disabled for this to work properly, else PHP may see the file upload only once fully uploaded.
- This feature doesn't work, when your webserver is running PHP via FastCGI.
- Don't forget, that the session has to be initialized before the form is generated, otherwise you will get no information in the session.
- It won't work in PHP 5.3 or earlier.
- Note that if you run that code and you print out the content of $_SESSSION[$key] you get an empty array due that session.upload_progress.cleanup is on by default and it cleans the progress information as soon as all POST data has been read. Set it to Off or 0 to see the content of $_SESSION[$key].
This can help you to track your progress bar http://pecl.php.net/package/uploadprogress
I hope this will help you to dig out the problem.
PHP Session upload progress EMPTY
I had exactly the same issue.
Solution was to simply replace the handler from FastCGI to PHP-FPM.
Also works on Mod PHP but it doesn't work on FastCGI even with the new PHP.
Session Upload Progress
Session cookie name has to be exactly the same as the one set in php config (session.name
), e.g.:
return array(
'native' => array(
'encrypted' => FALSE,
'name' => ini_get('session.name'),
),
);
If you don't want to use PHP's default session cookie name you will not get around this by setting the value during runtime, i.e. this won't work:
ini_set('session.name', 'my_kohana_session_name');
You will get around this by setting the value in your .htaccess file:
php_flag session.name "my_kohana_session_name"
This way you can keep the php.ini untouched but you can keep your custom cookie name for your Kohana application.
My tests proved that session encryption does not affect the upload progress information when using native session driver. That surely because the encryption is not used when using native driver regaldess the setting. ;)
PS. One thing I would also suggest - make sure that the ajax request is not cached. Had quite a few cases when it was cached and not showing fresh responses.
Related Topics
How to Convert an Integer to an Array in PHP
PHP $_Server['Remote_Addr'] Shows Ipv6
How to Recursively Obtain the "Parent Id" of Rows in This MySQL Table
SQL Query with Binary Data (PHP and MySQL)
How to Detect If Your Website Visitor Came from a Google Search Result
Sparql Query to Get All Parent of a Node
PHP Regex Get Text Between Bbcode Tags
Is There a Difference Between Instantiation with Parentheses or Without
PHP Preg-Replace More Than One Underscore
Create Unique Poll/Vote/Survey in PHP
Add Prefix to Auto-Increment in MySQL Db
Upload Xls or Xlsx Files with Codeigniter, Mime-Type Error
$_Post Empty on Utf-8 Characters