I am designing a form that will allow users to upload and e-mail multiple attachments. I am having trouble deleting the files after they have been sent.
Here is what I have:
<!--- put the files on the server --->
<cfif FORM.attachment_1 neq "">
<!--- first actually upload the file --->
<cffile action="upload"
filefield="attachment_1"
destination="c:\uploads\"
nameconflict="Makeunique">
<!--- now create a temporary holder for the attachment later on --->
<cfset attachment_local_file_1 = "c:\uploads\#file.serverfile#">
</cfif>
<cfif FORM.attachment_2 neq "">
<cffile action="upload"
filefield="attachment_2"
destination="c:\uploads\"
nameconflict="Makeunique">
<cfset attachment_local_file_2 = "c:\uploads\#file.serverfile#">
</cfif>
<!--- Attach the files to an e-mail --->
<CFMAIL TO="me@mydomain.com"
FROM="#qGetUser.Email#"
<cfif FORM.attachment_1 neq "">
<cfmailparam file="#attachment_local_file_1#">
</cfif>
<cfif FORM.attachment_2 neq "">
<cfmailparam file="#attachment_local_file_2#">
</cfif>
************So far so good**************
<cffile action="delete"
file = "c:\uploads\#file.serverfile#">
This will delete one of the files. How can I get it to delete all of them? I will probably have up to 5 attachments....
Thanks!
Kristine
Here is what I have:
<!--- put the files on the server --->
<cfif FORM.attachment_1 neq "">
<!--- first actually upload the file --->
<cffile action="upload"
filefield="attachment_1"
destination="c:\uploads\"
nameconflict="Makeunique">
<!--- now create a temporary holder for the attachment later on --->
<cfset attachment_local_file_1 = "c:\uploads\#file.serverfile#">
</cfif>
<cfif FORM.attachment_2 neq "">
<cffile action="upload"
filefield="attachment_2"
destination="c:\uploads\"
nameconflict="Makeunique">
<cfset attachment_local_file_2 = "c:\uploads\#file.serverfile#">
</cfif>
<!--- Attach the files to an e-mail --->
<CFMAIL TO="me@mydomain.com"
FROM="#qGetUser.Email#"
<cfif FORM.attachment_1 neq "">
<cfmailparam file="#attachment_local_file_1#">
</cfif>
<cfif FORM.attachment_2 neq "">
<cfmailparam file="#attachment_local_file_2#">
</cfif>
************So far so good**************
<cffile action="delete"
file = "c:\uploads\#file.serverfile#">
This will delete one of the files. How can I get it to delete all of them? I will probably have up to 5 attachments....
Thanks!
Kristine