Questions about uploading files

Source: Internet
Author: User
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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.