upload_tmp_dir cleanup

This is a discussion on upload_tmp_dir cleanup within the PHP Language forums, part of the PHP Programming Forums category; Hi, I have not set the "upload_tmp_dir" in my php.ini, so I am assuming it is using /...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008
howa
 
Posts: n/a
Default upload_tmp_dir cleanup

Hi,

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?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 04-18-2008
Erwin Moller
 
Posts: n/a
Default Re: upload_tmp_dir cleanup

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


Probably.
You can simply test however: Just spit out the $_FILES array from you
uploadscript.
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>";
print_r($_FILES);
echo "</pre>";

Look for: ['tmp_name']

Read more here:
http://nl3.php.net/manual/en/features.file-upload.php



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


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


>
> 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?


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


>
> Thanks.


Regards,
Erwin Moller
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0