Write a PHP Script to Upload the file and display its information.(use $_FILES).
FileUpload.html
<html>
<body>
<form method=post action="Uploadfile.php" enctype="multipart/form-data">
File Name : <input type="file" name="file" id="file" size=40%><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>
Uploadfile.php
<?php
if($_FILES["file"]["error"]>0)
{
echo"Error : ".$_FILES["file"]["error"]."<br>";
}
else
{
echo"Upload File : ".$_FILES["file"]["name"]."<br>";
echo"Type : ".$_FILES["file"]["type"]."<br>";
echo"Size : ".($_FILES["file"]["size"]/1024)." kb<br>";
echo"Temporary Storage : ".$_FILES["file"]["tmp_name"];
}
?>
<html>
<body>
<form method=post action="Uploadfile.php" enctype="multipart/form-data">
File Name : <input type="file" name="file" id="file" size=40%><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>
Uploadfile.php
<?php
if($_FILES["file"]["error"]>0)
{
echo"Error : ".$_FILES["file"]["error"]."<br>";
}
else
{
echo"Upload File : ".$_FILES["file"]["name"]."<br>";
echo"Type : ".$_FILES["file"]["type"]."<br>";
echo"Size : ".($_FILES["file"]["size"]/1024)." kb<br>";
echo"Temporary Storage : ".$_FILES["file"]["tmp_name"];
}
?>
Comments
Post a Comment