I am attempting a simple file upoad with first page:
Code: Select all
<form enctype="multipart/form-data" action="test_uploadck.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="75000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>Code: Select all
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
print "<pre>";
$target_path = 'Images/';
$target_path = $target_path . basename( $_FILES['userfile']['name']);
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['userfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>Code: Select all
Warning: move_uploaded_file(Images/AL19307A.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\estateagent1\test_uploadck.php on line 18
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\tmp\php43.tmp' to 'Images/AL19307A.jpg' in C:\Inetpub\wwwroot\estateagent1\test_uploadck.php on line 18a) the file being uploaded was not too big (only 22K) and did not exceed either MAX_FILE_SIZE (750000) in the script or post_max_size and upload_max_filesize (both 8M) in php.ini.
b) the folder I was moving the uploaded file to exists and has all permissions enabled in IIS
c) There were no normal input fields in the upload form
Where am I going wrong?