upload_tmp_dir cleanup

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have not set the "upload_tmp_dir" in my php.ini, so I am assuming it
is using /tmp/.

From time to time, I noticed that some strange files appear in the /
tmp, and when I viewed it, I believe it is the temp file which somehow
not handled correctly by my scripts and leave in the /tmp/ folder.

I want to ask, will PHP delete the files under this folder from time
to time automatically? Or should I setup a cron to clean up?


Re: upload_tmp_dir cleanup

howa schreef:
Quoted text here. Click to load it

You can simply test however: Just spit out the $_FILES array from you
It contains the path to the uploaded file (which gets a strange random
name during the process, but you should be able to see the path.)
echo "<pre>";
echo "</pre>";

Look for: ['tmp_name']

Read more here:

Quoted text here. Click to load it

No, unless you create a file in the tempdir yourself.
PHP cleans up the uploaded file when the script ends.

Quoted text here. Click to load it

Lots of processes on your server could be using the temp dir.
Setting up a cronjob that cleans up the old files in the tempdir (eg
older than a day) is always a good idea. :-)

Quoted text here. Click to load it

Erwin Moller

Site Timeline