You could always check for existence of the file and create a unique filename 
if it already exists. 




________________________________
From: Peyton Todd <[EMAIL PROTECTED]>
To: discussion@acfug.org
Sent: Friday, November 7, 2008 3:48:58 PM
Subject: [ACFUG Discuss] Another CFMAIL Problem

The web page I'm having a problem with builds a PDF document and attaches that 
to an e-mail. The problem is that the user can do this for successive job 
numbers one after the other (it's a site for court reporters to report back to 
the company that sent them on a job). I have been naming the PDF with the 
reporter's initials (e.g. PHT.pdf if I were one of them), and the bug is that 
frequently the PDF for the previous job gets attached instead of the PDF just 
built. 

One solution I thought of is simply to use the job number as the name of the 
PDF. This would guarantee that each next one built is different. But then it 
occurred to me that if the user reports a job, then realizes he made a mistake, 
corrects it, and sends the report again for the same job, there's a danger that 
the earlier mistaken version would get sent instead.

Here is the CFMAIL tag (names changed to protect the guilty):

<cfmail from="#sendfrom#" to="#sendto#"
   subject="Job #Session.sJobNo# has been reported by #Session.UserName#" 
   server="abc.def.net" username="[EMAIL PROTECTED]" password="blahblah"
   mimeattach="c:/Inetpub/wwwroot/Reporters/#Session.UserName#.PDF">
   Report completed: See Attached Job Sheet      
</cfmail>

The code which buildt the PDF attached by the code just above attempts to 
ensure that the PDF for the job just reported gets overwritten, and doesn't get 
cached, but evidently does not succeed:

<html>
<head>
<title>Post-Job Reporting</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<cfoutput><META HTTP-EQUIV="Expires" 
CONTENT="#GetHTTPTimeString(NOW())#"/></cfoutput>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<META HTTP-EQUIV="cache-control" VALUE="no-cache, no-store,must-revalidate"/>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="ACRGA.css"/>
</head>
<body>
<cfset filename = UCase(Session.UserName) & ".PDF"> 
<cfdocument format="PDF" filename="#filename#" overwrite="yes">
<TABLE border="1" width="100%" style="border-style:groove; font-size:14pt;">
   <TR><TD>
   <table width="100%">
   <cfoutput>
   <tr>
      <td valign="middle" align="left">

etc., etc.,...

Any ideas as to what might be wrong?

- Peyton


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to