Hi Guys,
In this article we are going to move How to upload the file using PHP. File uploading is mainly done to website like recruting sites, online applications etc. In recrutment site, the user upload their biodata, photo are uploaded through frond end and in here it connect to database also. But now we focus only how to upload the file to specific folder in php. The file uploading is very simple and easy to understand the process in php.
Table Of content
- The HTML
- The PHP
For uploading a file to specific folder contain only two part: html and php.
The HTML
The HTML parts are used in here for specify form,input and submit button in html for uploading operations. We use enctype=”multipart/form-data”helps to upload files in php. And input type=”file” to specify the type of input tag.
File Uploading To Specified Folder
- Method=”POST” : it should be POST.
- enctype=”multipart/form-data” : it’s specify content-type to be uploaded.
- type=”file” : attribute of the input tag shows input field as a file selector with a “Browse” Button.
The PHP
In php part,
- $folder: Specify directory for uploading files. In here uploaded_files is the folder to upload file in php.
- move_uploaded_files : php function that moves selected file to the specified folder.
Full Code
File Uploading To Specified Folder
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.