Like Us Like Us Facebook Subscribe Subscribe us YouTube Whatsapp Share us Whatsapp Query Send your queries

PHP File Uploading easy to learn tutorial with complete script

PHP File Uploading easy to learn tutorial with complete script

PHP is world’s no. 1 server side scripting language, it comes with plenty of features and one of the most famous one is file uploading which is extensively used world wide.

Self Explanatory PHP File Uploading Example

First Create a directory called  gallary/ .
Save this file as gallery.php

<!DOCTYPE html>

<html lang=”en”>
<head>
<title>File Uploading</title>
<meta charset=”utf-8″ />
</head><body>
 <?php
$path=”gallery/”;
$path=$path.$_FILES[‘file_upload’][‘name’];
if(isset($_POST[‘upload’]))
{
if(move_uploaded_file($_FILES[‘file_upload’][‘tmp_name’],$path))
{
echo “The file “.basename($_FILES[‘file_upload’][‘name’]).” has been uploaded”;
}
else
{
echo “There is an error,please retry or ckeck path”;
}
}
?>
<form action=”gallery.php” method=”post” enctype=”multipart/form-data”>
<table width=”384″ border=”1″ align=”center”>
<tr>
<td width=”108″>Select File</td>
<td width=”260″><label>
<input type=”file” name=”file_upload”>
</label></td>
</tr>
<tr>
<td><label>
<input type=”submit” name=”upload” value=”Upload File”>
</label></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</body></html>

3
Leave a Reply

avatar
3 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Fully HelpAnonymousOopsphp Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Oopsphp
Guest

thanks for sharing file uploading tutorial, its working

Anonymous
Guest
Anonymous

Which site?

Fully Help
Guest

Nice blog…Very useful information is providing by ur blog. find Great beginning php tutorials Very clear and helpful for beginners.

Do you have any Query / Suggestion