How to upload file or image in html form using php

How to upload file or image in html form using php

The source code of uploading a file is given below.


<?php
error_reporting(0);
?>

<html>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="uploadfile" value="">
<input type="submit" name="submit" value="Upload File">
</form>
</body>
</html>
<?php
$folder="student/";
$filename=$_FILES["uploadfile"]["name"];
$tempname=$_FILES["uploadfile"]["tmp_name"];
$folder="student/".$filename; // To save the image at folder student/image_name
//echo $folder;
move_uploaded_file($tempname,$folder);//temp location to destination
echo "<img src='$folder' height='100' width='100'/>" //This code is for showing the uploaded image
?>

Comments

Popular posts from this blog

Error http://172.0.0.1:8080/apex application not found in oracle 10g Solved

Sequence diagram of Airport Check-in and Sreening System in uml