php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37834 Sesssion Handling Issue
Submitted: 2006-06-17 22:27 UTC Modified: 2006-06-18 12:20 UTC
From: swcook at gmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.4.2 OS: Linux
Private report: No CVE-ID: None
 [2006-06-17 22:27 UTC] 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'].

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-17 22:28 UTC] SWCOOK at GMAIL dot COM
I don't think I made this clear enough, the script correctly names the file when accessed via Internet Explorer.
 [2006-06-18 12:20 UTC] bjori@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 06:01:34 2024 UTC