Hi guys, in this article we are going to understand how to upload a file
with the help of PHP. For this purpose you must install a XAMPP server.
Uploading a file from the form is really a good concept to have with your web
Let us see how we can create a form for loading up a file, so firstly we require
a design part using HTML The following is the script :
FILE UPLOADING </h3>
<form action="fileupload.php" method="post"
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" />
Save it as fileupload.html !
Result of above scripting
The above given code displays a web page having a browse input box and asubmit
button in it, here is what your web page looks like :
PHP scripting for file uploading
<body bgcolor="cyan" color="yellow">
uploaded !! <h3>
/ 1024) . " Kb<br
in: " . $_FILES["file"]["tmp_name"];
Saved it by fileupload.php !
Output of the above scripting
To run the code Open XAMPP server start the services like Apache and
MySQL .Open the browser type: http://localhost/yourfoldername/fileupload.html
Click on the Browse button you will have file upload window:
Select the file to upload then click open you will have a url of that file at
your browse input box as given below :
After clicking on the submit button the final result will display :
Conclusion : This is the information of your uploaded file. Thanks !!