PHP File Upload - build website - Phptpoint.com

PHP File Upload

/ins>

PHP File Upload

PHP File Uploading

Sometimes, you might want to upload your resume, Your Profile picture, any documents on the server,use File uploading concept in PHP.
With PHP File uploading concept you can easily upload your file your profile picture and your important document on the server.

PHP File uploading Form HTML script.
Define form method “post” and enctype=”multipart/form-data” both property must be defined for uploading a file.
upload.html

Output
Your File Name

The enctype attribute of the <form> tag specifies which content-type to use when submitting the form.

“multipart/form-data” is used when a form requires binary data, like the contents of a file, to be uploaded.

The type=”file” attribute of the <input> tag specifies that the input should be processed as a file.

For example, when viewed in a browser, there will be a browse-button next to the input field.

upload.php

Output
Upload: filename
Type: extension
Size: size of the file in bytes
Stored in: temporary file location

Note : first create a folder named upload

By using the global PHP $_FILES array you can upload files from a client computer to the remote server.

The first index is the form’s inputted name and the second index may be either “name”, “type”, “size”, “tmp_name” of the file such as
=> $_FILES[“file”][“name”] : The name of the uploaded file
=> $_FILES[“file”][“type”] : The type of the uploaded file
=> $_FILES[“file”][“size”] : The size in kilobytes of the uploaded file
=> $_FILES[“file”][“tmp_name”] : The temporary name of the file