#37834 [Com]: Sesssion Handling Issue
| From: | SWCOOK at GMAIL dot COM | Date: | Sat, 17 Jun 2006 22:28:42 +0000 |
| Subject: | #37834 [Com]: Sesssion Handling Issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98442@lists.php.net to get a copy of this message | ||
ID: 37834
Comment by: SWCOOK at GMAIL dot COM
Reported By: swcook at gmail dot com
Status: Open
Bug Type: Session related
Operating System: Linux
PHP Version: 4.4.2
New Comment:
I don't think I made this clear enough, the script correctly names the
file when accessed via Internet Explorer.
Previous Comments:
------------------------------------------------------------------------
[2006-06-17 22:27:00] swcook at gmail dot com
Description:
------------
I understand that PHP is server-side and this should really not happen,
but I have a purely php page that cannot access the $_SESSION unless a
user is using Internet Explorer. Moreover, Firefox and Opera cannot
access it.
Reproduce code:
---------------
<?php require_once('Connections/siteData.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php
function storPath($fileType){
if(stristr($fileType, ".avi") === TRUE || stristr($fileType, ".mov")
=== TRUE){
return 'media';
} else {
return 'images';
}
}
$uploadFile = $_SESSION['username']."_".
basename($_FILES['Filedata']['name'] );
$storage = storPath($uploadFile);
//path name of file for storage
$uploadFilePath = $storage."/".$uploadFile;
//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] ,
$uploadFilePath ) ) {
//populate session array to be passed to SQL
$_SESSION['upFile'][] = $uploadFile;
echo( '1 ' . $_FILES['Filedata']['name']);
//file failed to move
}else{
echo( '0');
}
?>
Expected result:
----------------
If the uploaded file is named "james_2003.jpg" and
$_SESSION['username'] = "wilson" I expect the file to be saved on the
server as "wilson_james_2003.jpg".
Actual result:
--------------
File is saved simply as "_james_2003.jpg". It correct appends"_",
however, it doe not append $_SESSION['username'].
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37834&edit=1