Upload File

Often there is also a need to transfer a file to the server, for example by adding a photo to the gallery. The file is transferred using the form field type „file”. Please note that the opening tag form must find a parameter ENCTYPE = „multipart / form-data” and the form must be sent using the POST method.

The site which was sent form will be available multidimensional associative array $ _FILES ($ HTTP_POST_FILES in older versions of PHP), which will be the first dimension field type file the form (the keys are the names of these fields), and the second information about the uploaded file.

 

About transmitted file
TMP_NAME
the name of the file on the server along with the path; using this field, you can access the uploaded file
name
the name of the file that have the user’s
type
MIME type of the file eg. text / plain or image / gif; This information is available only if the browser client provided such information.
size
file size in bytes

Cookies help us deliver our services. By using our services, you agree to our use of cookies. More Info | Close