Hi Friends,
I am new to PHP , so please forgive me if I ask any silly questions.
I want to upload a file & then store it in mysql.But I am facing some problems .I am pasting my code please have a look at it & tell me how to overcome this problem.
html code:---
<form action="index.php?action=1030" method="post" enctype="multipart/form-data" name="uploadform">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="userfile" type="file" class="box" id="userfile">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>
PHP code--------------
$fileName = $FILES['uploadform']['name'];
$tmpName = $FILES['uploadform']['tmp_name'];
$fileSize = $FILES['uploadform']['size'];
$fileType = $FILES['uploadform']['type'];
$uploaddir = getcwd();
echo $uploaddir."\".$fileName;
if(move_uploaded_file($_FILES['uploadform']['tmp_name'],$upload_dir."\".$filename))
{
echo "file moved....";
}
else {
echo "better luck next time";
}
problem i am facing that each time the move_uploaded_file is returning false.
Please help...me.....it's urgent.......
thanx...
Report this post