This is a snippet of code from the top of my script, but not to the bottom. It is supposed to generate a unique 6 digit folder name, then move the uploaded file to it. I didn't show the first block of code that generates the number and creates the folder because it works.
Code:
// Script generates a unique 6 digit number, called $randomdir
// Then it makes the appropriate folder in ./temporary/$randomdir and CHMODs it 0777
// Where the file is going to be placed
$target_path = "temporary/$randomdir/";
// Add the original filename to our target path.
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
$target_path = "temporary/$randomdir/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
die("There was an error uploading the file, please try again");
}
All I get returned is
Code:
Temporary folder created
There was an error uploading the file, please try again
Please can somebody help me find out why the script is causing this error. It was working previously but then it stopped working and I can't fix it on my own.
Thanks
- Sam