Upload Files in form tag
Posted: Tue Apr 27, 2010 12:50 am
Hi all,
I have this upload file code, independently i can run this file but when i what to add in my codes, it doesn't work. What issue should i aware of and and if my codes already have form tag, which part should i paste this code to make sure that it runs? My concern is
I have this upload file code, independently i can run this file but when i what to add in my codes, it doesn't work. What issue should i aware of and and if my codes already have form tag, which part should i paste this code to make sure that it runs? My concern is
Code: Select all
enctype="multipart/form-dataCode: Select all
<?
if($_POST['check']){
$faillampiran=$_POST['faillampiran'];
$file=$_FILES['faillampiran']["name"];
$fileSize = $_FILES['faillampiran']['size'];
$fileType = $_FILES['faillampiran']['type'];
if ($_FILES["faillampiran"]["error"] > 0 )
{
echo "Return Code: " . $_FILES["faillampiran"]["error"] . "<br />";
}
else
{
move_uploaded_file($_FILES["faillampiran"]["tmp_name"],"upload/" . $_FILES["faillampiran"]["name"]);
echo '<table align = "center">';
echo "<tr><td>";
echo "Your file has been successfully stored.";
echo "</td></tr>";
echo '</table>';
}
}
?>
<form method="post" name="form1" id="form1" enctype="multipart/form-data">
<tr><td></td><td><input type="hidden" name="MAX_FILE_SIZE" value=""> </td> </tr>
<tr><td> Please choose a file</td><td>:</td></tr>
<tr>
<input type="file" size="50" name="faillampiran" alt="faillampiran" id="faillampiran" 1value= "<?=$faillampiran;?>" />
<tr align = "center"><td colspan = "3"><input type="submit" value="Hantar" name="check"/></td></tr>
</tr>
</form>