|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-17 22:28 UTC] SWCOOK at GMAIL dot COM
[2006-06-18 12:20 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
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'].