Page 1 of 1

hi getting problem to upload file via php

Posted: Mon Apr 07, 2008 12:05 pm
by manpreet_jsb
i am trying to upload image to web serverAPI(ISAPI)

this is the test.php page
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-9' />
<title>welcome to ermata&#351;</title>
</head>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>


my uploader.php code have this code
<?php
// turn on all run-time errors:
ini_set('display_errors', 1);
error_reporting(E_ALL);
$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!";
echo "<pre>".print_r($_FILES,1)."</pre>\n";
}
?>


giving error

Warning: move_uploaded_file(uploads/10x10.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\inetpub\ermatas.com\www\uploader.php on line 9

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\php\upload\php2394.tmp' to 'uploads/10x10.gif' in D:\inetpub\ermatas.com\www\uploader.php on line 9
There was an error uploading the file, please try again!
Array
(
[uploadedfile] => Array
(
[name] => 10x10.gif
[type] => image/gif
[tmp_name] => C:\php\upload\php2394.tmp
[error] => 0
[size] => 49
)

)

plz help me to solve this problem, do i need to change in php.in