PHP Files

If you want your users to be able to upload a file, you need an HTML page with a form and a php script to process that form.

To upload files the form’s method has to be set to POST and you have to set the enctype of that form to multipart/form-data.

To display information about the uploaded file you can use the $_FILES superglobal

Handling file uploads

Here is the HTML form:

STEP 1. Accessing file data via $_FILES:


STEP 2. Storing file data into variables if the temporary file has been uploaded

STEP 3. Move and rename the temporary file