Sunday, March 23, 2014

FILES method in PHP

<?php
echo "<center>";
//you get the following information for each file:
$a=$_FILES['photo']['name'];
$b=$_FILES['photo']['size'];
$c=$_FILES['photo']['type'];
$d=$_FILES['photo']['tmp_name'];

if(empty($a))
{
echo "Please choose your file!<br/>";
}
else
echo "Wait file is processing";

/*echo $a."<br/>";
echo $b."<br/>";
echo $c."<br/>";
echo $d;
echo "</center>";*/
?>

<form method="post" enctype="multipart/form-data">
Your Photo: <input type="file" name="photo" size="25" />
<input type="submit" name="submit" value="Submit" />
</form>
<table width="40%" align="center">
<tr>
<th>
Image Name
</th>
<th>
Image Size
</th>
<th>
Image Type
</th>
</tr>
<tr>
<td>
<?php echo $a; ?>
</td>
<td>
<?php echo $b; ?>
</td>
<td>
<?php echo $c; ?>
</td>
</tr>
</table>

Output:-


No comments:

Post a Comment