When a file is uploaded, $ _ FILES ['XX'] ['tmp _ name'] is the temporary file valid?

Source: Internet
Author: User
When a file is uploaded, $ _ FILES [XX] [tmp_name] is the temporary file valid? To do a business, you need to extract data from the excel file uploaded by the user, but you do not need to save the excel file.
I read data through the uploaded temporary file $ _ FILES ['Excel '] ['tmp _ name. But will this temporary file be automatically cleared? If it is automatically cleared, how long is the temporary file valid? in linux (centos), where is the temporary file uploaded by php (installed through yum) stored?
Thank you!


Reply to discussion (solution)

Yes, it will be automatically cleared. The request is deleted at the end of the request.
In linux, you can use phpinfo () to view the location of the temporary directory.

The validity period should be managed in linux.

The request is deleted at the end of the request. I personally think it is better to save the file directly when deleting it.

After the user uploads a file and saves the data, the ulink temporary file is ready.

$ _ FILES ['Excel '] ['tmp _ name'] indicates the absolute path for uploading temporary FILES.
The life cycle for uploading temporary files is the same as that for processing the uploaded php program (that is, the program ends and the temporary files disappear)
The move_uploaded_file function can remove temporary files in advance.

Thank you for your kindness.

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.