Hi,
I am trying to write an upload script and everytime i try and upload a file it will give me an error.
Warning: move_uploaded_file(/home/******/public_html/dw/uploads) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/******/public_html/dw/upload2.php on line 3
I have checked that the folder is there as the error suggests that it is not there but it is definately there.
My code is as follows
upload1.php
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form enctype="multipart/form-data" method="post" action="upload2.php">
Send this file: <input name="userfile" type="file" /><br />
<input type="submit" value="Send File" />
</form>
</body>
</html>
and upload2.php
<?php
if (move_uploaded_file($_FILES['userfile']['tmp_name'], "/home/alanhuno/public_html/dw/uploads")) {
print "Received {$_FILES['userfile']['name']} - its size is {$_FILES['userfile']['size']}";
} else {
print "Upload Failed";
}
?>