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.