| |||||||||||
| |||||||||||
CGItemp files Posted by TedH (TedH), 5 October 2005 In writing a Perl based CMS, I've run across a weird thing that happens when a file is uploaded. My script can add, edit and delete the text based files nice as you please. If an image is needed I can upload to the correct folder in the webspace fine. However, on a Windows based machine a file named CGItemp***** (***** = random number) is created in the same folder as the upload script and left there. The CGItemp file is the same size as the image that was uploaded - so I understand why it's there. Now on Apache/Unix (evidently), this gets deleted immediately - but not on a Windows server. This seems to be a common problem and the replies I've seen say cgi.pm takes cares of - no it does not. Only by FTP'ing in and manually delete does it go. I've got a feeling that there must be some way to unlink any file in that folder that begins with CGItemp, but don't know it. Any suggestions? cheers - Ted Posted by admin (Graham Ellis), 5 October 2005 Here's an example that deletes all files that match a particular pattern in a particular directory. I've printed out the names and NOT deleted them in this test code - just uncomment the unlink line to make it work.Code:
To change to CGItemp files, replace the \.tgz$ regular expression with ^CGItemp. I have used the "i" (ignore case) modifier because you're talking Windows in the question .... Posted by TedH (TedH), 6 October 2005 Thanks Graham, that works very nicely.Now I can have an option for Windows users so the temporary files can be purged. Did you ever get the directory done that you mentioned? cheers - Ted This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |