Questions about file uploading recently I am listening to php videos. one of them is not understandable.
If (is_uploaded_file ($ _ FILES ['upfile'] ['tmp _ name']) {
$ Upfile = $ _ FILES ["upfile"];
}
It is mainly about the value. for example, I know the value of upfile is obtained from the form, but I don't know how to obtain the value of tmp_name. please kindly advise. thank you!
Reply to discussion (solution)
$ _ FILES is a global array that stores information about file upload.
The first parameter is the input name of the form, and the second subscript can be "name", "type", "size", "tmp_name" or "error ". Like this:
$ _ FILES ["file"] ["name"]-name of the uploaded file
$ _ FILES ["file"] ["type"]-type of the file to be uploaded
$ _ FILES ["file"] ["size"]-size of the uploaded file, in bytes
$ _ FILES ["file"] ["tmp_name"]-name of the temporary copy of the file stored on the server
$ _ FILES ["file"] ["error"]-error code caused by file upload
$ _ FILES is a global array that stores information about file upload.
The first parameter is the input name of the form, and the second subscript can be "name", "type", "size", "tmp_name" or "error ". Like this:
$ _ FILES ["file"] ["name"]-name of the uploaded file
$ _ FILES ["file"] ["type"]-type of the file to be uploaded
$ _ FILES ["file"] ["size"]-size of the uploaded file, in bytes
$ _ FILES ["file"] ["tmp_name"]-name of the temporary copy of the file stored on the server
$ _ FILES ["file"] ["error"]-error code caused by file upload
I understand. Is it the default system?
I have learned php for less than two months.
I have read all the php basic tutorials.
The entries in $ _ FILES will be stored with the name of Tag from your
HTML form. Your form element is named userfile, so the array will have the following
Contents:
N The value stored in $ _ FILES ['userfile'] ['tmp _ name'] is the place where
File has been temporarily stored on the web server.
N The value stored in $ _ FILES ['userfile'] ['name'] is the file's name on
User's system.
N The value stored in $ _ FILES ['userfile'] ['size'] is the size of the file in bytes.
N The value stored in $ _ FILES ['userfile'] ['type'] is the MIME type of
File? For example, text/plain or image/gif.
N The value stored in $ _ FILES ['userfile'] ['error'] will give you any error
Codes associated with the file upload. This functionality was added at PHP 4.2.0.
Tmp_name, which is a random file name