File Upload $_files[' XX ' [' tmp_name '] temporary file validity period solution?

Source: Internet
Author: User
To do a business, you need to extract data from the user's uploaded Excel, but you don't need to save Excel.
I read the data by uploading temporary files $_files[' Excel ' [' Tmp_name ']. But will this temporary file be erased automatically? If it is automatically cleared, how long is the temporary file valid, and which directory is the temporary upload file for PHP (installed via Yum) under Linux (CentOS)?
Thank the Great God!

Reply to discussion (solution)

Yes, it will be cleared automatically. When the request ends, it is deleted.
Under Linux you can use Phpinfo (); View the location of the temp directory

The expiration date should be Linux management.

The request ends when it is deleted. Personal feel to save files directly when finished using delete better control.

After the user uploads the file, saves the data, ulink the temporary file.

$_files[' Excel ' [' tmp_name '] means the absolute path of the upload temporary file
The lifetime of the upload temporary file is the same as the PHP program that handles the upload (that is, the program ends and the temp file disappears)
Move_uploaded_file function to make temporary files disappear prematurely

Really useful, thanked the great God.

  • Related Article

    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: 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.