Ajax file upload script overwrites my session variables PHP

leeVNX

New Member
Below is the script that my ajax file uploader uses. The uploader itself works fine but i need a method of storing the files that are uploaded and I am using session variables. The problem is if I upload more than one file the first session variable is being overwritten each time i upload a file and so i end up with only $_SESSION['hamhamham'] containing data. Can someone tell me what i am doing wrong here? Thanks in advance\[code\]session_start();$uploaddir = '../uploads/';$uploadfile = $uploaddir . date() .time() . basename($_FILES['myfile']['name']);/* $_SESSION['hamhamham'] = $uploadfile; */$full = false;if(isset($_SESSION['hamhamham'])){ if(isset($_SESSION['hohoho'])){ if(isset($_SESSION['workforme'])){ if(isset($_SESSION['sweet'])){ $full = true; }else{ $_SESSION['sweet'] = $uploadfile; } }else{ $_SESSION['workforme'] = $uploadfile; } }else{ $_SESSION['hohoho'] = $uploadfile; }}else{ $_SESSION['hamhamham'] = $uploadfile;}if($full==false){ if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) { echo "success"; } else { // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE! // Otherwise onSubmit event will not be fired echo "error"; }}else{ echo "too many files uploaded";}\[/code\]
 
Back
Top