473,322 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.
Jun 2 '08 #1
1 3518
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
Jun 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim218 | last post by:
Hi Everyone This is my first day with PHP and, not surprisingly, I've run into a problem :-) I want to allow file uploads to the server without exposing the non-technical end-users to FTP...
1
by: Xenofon Papadopoulos | last post by:
When I was using /usr/tmp to keep the temp uploaded files, move_uploaded_file used to fail randomly. Since I created a directory owned by nobody:nobody (my apache user) and set upload_tmp_dir to...
0
by: Robert_Wr | last post by:
hello PHP Masters:) my privider set: safe_mode to ON and leave upload_tmp_dir blank I think that there is the reason for my trouble with upload files via POST method. If yes - I will ask my...
2
by: iulian.ilea | last post by:
I have a problem when I upload files: if try to upload files stored in the same directory whith upload script it is ok, it uploads them on the ftp. IF I select a file from another directory than...
1
by: TJ | last post by:
Hello All, This is my first posting on this group and I'm also new to PHP ;-) We have a client who is providing Web Hosting Solutions to customers. One of the latest requirements is to enable...
1
by: Jason S | last post by:
I haven't used try/catch/finally very much in Javascript. My function (let's call it try_it()) needs to call a function that could throw an exception (let's call it dangerous()) with some setup()...
69
by: MQ | last post by:
Hi all I am just wondering how most people implement cleanup in C functions. In particular, if the function opens a number of resources, these need to be released properly should an error occur...
1
by: howa | last post by:
Using Windows, PHP5.2 ini_set("upload_tmp_dir", "c:/temp"); echo ini_get('upload_tmp_dir'); // print out the default one no effect...
2
by: TheReckter | last post by:
I'm currently on a shared host, and upload_tmp_dir is set to none, I was wondering if I was required to change that value to allow for file uploads, and how I could go about doing that, as I cant...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.