PDA

View Full Version : Deleting file from server after sending email with file attached


Ian H
06-12-2009, 03:45 AM
I'm trying to build a form that allows a user to upload a file for attaching to the email that is sent from the form and then deletes the file once the email has been sent using ASP and Digital File Pro V1

I'm had a look in the server behaviours for Digital File Pro and chose the following from my file upload server behaviours

WA Upload Files (attachment) <%=WA_DFP_UploadStatus.Item("WA_UploadResult1").serverFileName%> (ignore the space in serverFileName I have no idea why it's there I can't seem to remove it and it's not in my code)

I'm guessing I have to choose the serverFileName as that's the name of the file I've just uploaded to the server and want to delete. I'm also referencing the folder on the server that files are uploaded to.

The email sends and the file is attached properly, however the file isn't being deleted from the server. How can I get it to delete this file once the email has been sent?

Ian H
06-12-2009, 03:59 AM
I've sorted my problem. I used a session variable to store the name of the file I was uploading and then placed the delete file server behaviour on the page that appeared after the email had been sent. Everything seems to be working fine now.