Upload interface
Assuming that the file domain name in this interface is userfile, we can open a file selection window through browsing. After the selection is complete, the text box will show the complete path of the real file on the local machine. After you press upload, the file will be transferred to the temporary directory on the server and renamed as php ?. Tmp, where the question mark is a random number.
The html code is as follows:
<Form action = "upload. php" method = "post" enctype = "multipart/form-data" name = "form1">
<Input type = "hidden" name = "MAX_FILE_SIZE" value = "30000">
<Input name = "userfile" type = "file">
<Input type = "submit" name = "Submit" value = "Upload">
</Form>
After being transferred to another file upload. php, you can use the following variables to access information related to the file.
$ Userfile_name upload document name
$ Userfile_tmp_name temporary name for saving the uploaded document
$ Userfile_size size of the uploaded document, in bytes
$ Userfile_type the mime type of the document to be uploaded
The preceding variables are normal in windows + apache, but the following variables can be used if they are inaccessible in linux.
$ _ FILE ['userfile'] ['name'] is equivalent to $ userfile_name
$ _ FILE ['userfile'] ['tmp _ name'] is equivalent to $ userfile_tmp_name
$ _ FILE ['userfile'] ['SIZE'] is equivalent to $ userfile_size
$ _ FILE ['userfile'] [type] is equivalent to $ userfile_type