Uploading Bug in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
selvaganesh87
Forum Newbie
Posts: 6
Joined: Wed Aug 25, 2010 8:18 pm

Uploading Bug in PHP

Post by selvaganesh87 »

:help: Am learning PHP, i tried a concept of uploading a file am getting an error that i used in the else statement "Could not Upload" can any body bug this error

This is Front end HTML Coding


<HEAD>
<TITLE>Upload Your File</TITLE>
</HEAD>
<BODY>
<FORM ENCTYPE="multipart/form-data" ACTION="fileUpload.php" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="200000"><BR>
<BR>
FILE NAME
<INPUT TYPE="FILE" NAME="userfile">
<BR>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Send">
</FORM>
</BODY>
</HTML>

This is Back End PHP Coding

<?
$userfile = $_POST['userfile'];
if($userfile=="none") {
echo "Select the file to upload";
exit;
}
if(move_uploaded_file($userfile,"\\upload\\".$userfile_name)) {
echo "File Uploaded";
}
else {
echo "Could not Upload";
}
?>
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Uploading Bug in PHP

Post by yacahuma »

check your directory permission. Also you dont have to use backslash(\), changes those to forward slash (/).
Post Reply