PHP File Uploading tutorial with example

PHP File Uploading tutorial with example

In this tutorial I am going to demonstrate how to upload a file (like images, word and PDF documents, videos, ZIP) using PHP to server.

Create a directory “uploads” in your project directory.

<! DOCTYPE html>
<meta charset=”utf-8″/>
<title>PHP File Upload</title>

echo “The file “.basename($_FILES[‘file_upload’][‘name’]).” has been uploaded”;
echo “There is an error,please retry or ckeck path”;

<form action=”” method=”post” enctype=”multipart/form-data”>
<table width=”384″ border=”1″ align=”center”>
<td width=”108″>Select File</td>
<td width=”260″><label>
<input type=”file” name=”file_upload”>
<input type=”submit” name=”upload” value=”Upload File”>


In Upcoming tutorial we will learn how to upload only images, images with particular size, PDF, DOC, exel file, how to compress images and upload to server.

2 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Do you have any Query / Suggestion