I am using this code to upload a document to my server.
<?php
if ($_FILES["file"]["error"] > 0){
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}else{
echo getcwd().'<br>';
echo "Upload in file named: " . $_FILES["file"]["name"] . "<br>";
$info = pathinfo($_FILES['userFile']['name']);
$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$target = 'upload/100.'.$ext;
move_uploaded_file( $_FILES['file']['tmp_name'], $target);
}
?>
I am getting these error message:
Warning: move_uploaded_file(C:Inetpubvhostsapi.cutm.ac.inhttpdocsUploadMarksupload100.docx) [function.move-uploaded-file]: failed to open stream: Permission denied in C:Inetpubvhostsapi.cutm.ac.inhttpdocsUploadMarksuploadFile.php on line 14
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:WindowsTempphpF64C.tmp' to 'C:Inetpubvhostsapi.cutm.ac.inhttpdocsUploadMarksupload100.docx' in C:Inetpubvhostsapi.cutm.ac.inhttpdocsUploadMarksuploadFile.php on line 14
What am I doing wrong? What changes do I need in my code? Please help me in this regard.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…