Solved

coldfusion website - manage temporary files

Posted on 2010-09-24
11
620 Views
Last Modified: 2013-12-24
My coldfusion website generates temporary files(files with exension .tmp) for some images

What is the ideal way to clean these files, how should be the temporary files managed in such websites? thanks....
0
Comment
Question by:at999
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 16

Accepted Solution

by:
duncancumming earned 250 total points
ID: 33760458
I'd say setup a scheduled task to run as often as you need it to, that deletes these files.  How do you store the .tmp files?  All in one folder, or a new folder each time?  What you want to watch out for is deleting any .tmp files that are still required.  You could use the date last modified attribute (if doing a cfdirectory) if they're all in the same folder.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 33760573
Under what circumstances are these tmp files created?
During file upload?
Could you explain a bit more - for ex. was the creation of these tmp files written on purpose by someone?
Are they under the website directory or are they in the windows ColdFusion temp directory?
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33760644
(no points please)

Some processes in CF may create temporary files. For example file uploading, charting, etc... But CF typically those files itself, automatically  So as mentioned, please clarify whether you are talking about those types of files ... or some other temporary files _you_ create explicitly within your application code.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33760734
>> But CF typically those files itself, automatically

Correction: ... typically REMOVES those files ... automatically
0
 

Author Comment

by:at999
ID: 33788735
thanks ......... actually the files gets generated by a coldfusion code - i call coldfusion function GetTempFile()
something like this
<cfset mytempFile = GetTempFile(Application.TempDir,"A1")>

what is the ideal way to clean such files... thanks
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 25

Assisted Solution

by:dgrafx
dgrafx earned 250 total points
ID: 33789215
without asking why are you doing this ...

<CFDIRECTORY action="list" listinfo="name" type="file" directory="#Application.tempDir#" filter="*.tmp" name="files">
<cfloop query="files">
      <cfif fileExists(Application.tempDir & files.name)>
            <cfset fileDelete(Application.tempDir & files.name)>
      </cfif>
</cfloop>
0
 

Author Comment

by:at999
ID: 33789651
sorry dgrafx, i forgot to mention that these tmp files  are created to create image files from oracle blob tables
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 33789733
yeah - ok
just use the code i posted
it will work

good luck
0
 

Author Comment

by:at999
ID: 33789849
thanks a lot to all for your help...   i will create a coldfusion schedule task to delete the temporary files - ussign cf command - fileDelete(Application.tempDir & files.name)
0
 

Author Closing Comment

by:at999
ID: 33789864
thanks to all of you for the help
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33802700
>> i forgot to mention that these tmp files  are created to create image files from oracle blob tables

Just wondering ... but is there a reason you need to do this? In many cases it's not necessary to have physical files since a lot of cf tags work with blobs as well.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sick of fighting with footer widgets 5 51
Problem to go to Web page 2 52
Video on my site 4 28
Editing login page in zencart. 2 15
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now