Hello all,
I am working on an upload function and am having problems. This is the message that it says:
Warning: move_uploaded_file(../../../../data/C0017593-Human_brain,_PET_scan-SPL.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/...(other stuff) on line 163
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/Applications/XAMPP/xamppfiles/temp/phpMtgNWy' to '../../../../data/C0017593-Human_brain,_PET_scan-SPL.jpg' in /Applications/XAMPP/xamppfiles/htdocs/...(other stuff) on line 163
Line 163 is "if(move_uploaded_file...etc."
Here is the code:
<?php
$target_path = "../../../../data/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
//this line of code below is line 163
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
I would appreciate any help! I am stuck and have no idea what is wrong! Thanks