How to upload files through PHP ?

<!DOCTYPE html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title></title>
 <style>
 input[type='submit']{background:rgba(0,102,255,1); border:1px solid rgba(0,102,255,1); border-radius:5px; width:100px; height:30px; font-family:roboto; color:rgba(255,255,255,1); font-size:18px; cursor:pointer;}
 </style>
 </head>
<body>
 <center>
 <form action="select.php" method="post" enctype="multipart/form-data">
 <input type="file" name="image"/>
 <input type="submit" name="submit" value="Upload"/>
 </form>
 </center>
 </body>
 </html>
 <?php
 if(isset($_REQUEST['submit']))
 {
 $name=$_FILES['image']['name'];
 if(!$name)
 {
 echo "Please select file";
 }
 else
 {
 move_uploaded_file($_FILES['image']['tmp_name'],"newfolder/".$name);
 echo "<center><a href=newfolder/$name target='_blank' buffer='write'> View deails </a></center>";
 echo "<center>"."<img src=newfolder/$name width='250px' height='250px' />"."</center>";
 }
 }
?>

<!– MAKE SURE THAT YOU CREATE A FOLDER IN THE SAME AREA WHERE YOU SAVE YOUR ‘select.php’ FILE  AND NAME IT AS ‘newfolder’ WHERE YOUR ALL UPLOADED FILES WILL STORE –>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s