Questions about file uploading recently I am listening to php videos. one of the codes does not understand if & nbsp; (is_uploaded_file ($ _ FILES ['upfile'] ['tmp _ name']) {$ upfile = $ _ FILES ["upfile"];} it is mainly about the doubts about uploading files.
I 've been listening to a php video recently. one of the codes does not understand it.
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! Share:
------ 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
------ Solution --------------------
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.
------ Solution --------------------
Tmp_name, which is a random file name
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.