|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-12-25 05:07 UTC] Chriswright96 at hotmail dot com
Description:
------------
When using an upload form, with a hidden field with the session.upload_progress.name, the target page cannot set new session variables.
If you use the example below (with session.upload_progress.cleanup set to off for debugging), you will notice that the 'new' session disappears when you navigate back to the first page.
Test script:
---------------
//test1.php
<form name="fileupload" action="test2.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="newfile">
<input type="submit" name="submit" value="Submit">
</form>
<?php
if(!isset($_SESSION)) {
session_start();
}
print_r($_SESSION);
?>
//test2.php
<?php
if(!isset($_SESSION)) {
session_start();
}
$_SESSION['new']='Im a new value that will disappear';
print_r($_SESSION);
?>
<a href="test.php">Go back</a>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 13:00:01 2025 UTC |
This can be solved by using: if (session_status() == PHP_SESSION_NONE) { session_start(); } Instead of: if(!isset($_SESSION)) { session_start(); } But the reasoning behind this is still not clear in documentation