Well for the last few days i been trying to figure out how to delete attachments and download attachments to my computer. The deleting is sort of working and i don't know where to begin on downloading. Right now with the deleting it will delete from the attachments folder on the server but it does not delete from the database an was wondering if someone could explain what i am doing wrong on deleting attachments and how i could make it where a user could download an attachment to there computer? Here is what i have.
Expand|Select|Wrap|Line Numbers
- <cfparam name="form.confirmed" default="0">
- <cfquery name="attachment" datasource="CustomerSupport">
- SELECT fk_ticketID,description,path
- FROM dbo.tbl_CS_attachments
- WHERE fk_ticketID = #URL.pk_ticketID#
- </cfquery>
- <form method="post">
- <cfoutput query="ticket">
- <input type="hidden" name="pk_ticketID" id="pk_ticketID" value="#pk_ticketID#" />
- </cfoutput>
- <cfoutput query="attachment">
- <input type="hidden" name="fk_ticketID" id="fk_ticketID" value="#fk_ticketID#" />
- </cfoutput>
- <cfoutput query="attachment">
- #description#
- <a href="attachments/#path#" target="_blank" >view</a>
- <br>
- <cfif form.confirmed EQ 1>
- <cflock timeout="60">
- <cffile action="delete"
- file="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#path#">
- </cflock>
- </cfif>
- <input type="hidden" name="confirmed" value="1">
- <input type="hidden" name="fk_ticketID" value="#fk_ticketID#">
- <input type="submit" value="delete" onClick="return confirm('Are you sure you want to delete?')">
- </cfoutput>
- </form>
Rach