dthomas06
asked on
Deleting a file from the coldfusion server
How do I delete a file directly after it has been selected for download? Everything I keep doing ends up deleting the entire directory or just a specific file.
I'm sorry if this is a stupid question.
I'm sorry if this is a stupid question.
can you post a code snip?
ASKER
<cfloop query="getfile">
<cfif Type IS "Dir">
<a href="#cgi.SCRIPT_NAME#?Di rPath=#url .DirPath#\ #name#&Cas eN=#url.Ca seN#"><img src="../images/folder.gif" width="19" height="17" border="0"> #name#</a>
<cfelse>
#name#<a href="NewIndex3_VOpenFile. cfm?filepa th=#url.Di rPath#%5C# name#" target="_blank"> Download</a> <cffile action="delete" file="#url.DirPath#%5C#nam e#">
</cfif>
<br>
</cfloop>
<cfif Type IS "Dir">
<a href="#cgi.SCRIPT_NAME#?Di
<cfelse>
#name#<a href="NewIndex3_VOpenFile.
</cfif>
<br>
</cfloop>
it is not a stupid question, just a very unclear one:
- what do you mean by "after is has been selected for download"? when exactly is this moment? where in your application logic does this happen?
- post the code you are currently using to delete the file, and it will be easier for everyone to see where the problem may be.
"Everything I keep doing ends up deleting the entire directory..." - not good
"... or just a specific file." - sn;t this what you want, to delete a specific file?
- what do you mean by "after is has been selected for download"? when exactly is this moment? where in your application logic does this happen?
- post the code you are currently using to delete the file, and it will be easier for everyone to see where the problem may be.
"Everything I keep doing ends up deleting the entire directory..." - not good
"... or just a specific file." - sn;t this what you want, to delete a specific file?
ASKER
Sorry it's not clear.
After the people log in to the system and click to see what files are available for download a list is pulled of Files located on a section of our directory. As soon as they click download on a specific file or several minutes after the fact they want the file to be deleted from the directory.
As far as the specific file being deleted the only way that happens is when I plug in the files name in the tag <cffile action="delete" file="#url.DirPath#%5C#nam e#">.
After the people log in to the system and click to see what files are available for download a list is pulled of Files located on a section of our directory. As soon as they click download on a specific file or several minutes after the fact they want the file to be deleted from the directory.
As far as the specific file being deleted the only way that happens is when I plug in the files name in the tag <cffile action="delete" file="#url.DirPath#%5C#nam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much azadisaryev. I just did it and it worked. I was concerned about a file downloading quick enough and said numerous times that we needed to make sure the file would complete downloading as we are looking at files over 40 MB.