Can't upload file to apache server
Posted: Sat Jul 23, 2016 7:14 pm
I have a php script that is used for uploading image to a folder in the /var/www/html folder.
THere is always the error message poping out. I tried giving permission to the folder and the script but it won't work.
Any suggestions?
Thanks
Code: Select all
<?php
$target_path = "uploads/";
$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{
echo "There was an error uploading the file, please try again!";
}
?>
Any suggestions?
Thanks