i'm using this snippet to upload multiple files:
<?
//upload need passed from previous form
$uploadNeed = $_POST['uploadNeed'];
// start for loop
for($x=0;$x<$uploadNeed;$x++){
$file_name = $_FILES['uploadFile'. $x]['name'];
// strip file_name of slashes
$file_name = stripslashes($file_name);
$file_name = str_replace("'","",$file_name);
$copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$file_name);
// check if successfully copied
if($copy){
echo "$file_name | uploaded sucessfully!<br>";
}else{
echo "$file_name | could not be uploaded!<br>";
}
} // end of loop
?>
This works fine but i cant seem to alter where the file gets stored, at the moment they are stored in whatever dir the script is in. I've been messing with this code to try and move the file but the changes dont seem to alter anything and the file still uploads to the current dir.
this is the code i've been trying, i've taken it out of the snippet above to show what the working script looks like.
$uploaddir = '/pathfrom/serverRoot/to/folder/';
$uploadfile = $uploaddir . $_FILES['uploadFile'. $x]['name'];
move_uploaded_file($_FILES['uploadFile'. $x]['name'], $uploadfile);
would really appreciate any help, thanks.