I am using CF 5 with an MS Access database (moving to SQL Server in
the next 2 months). CF will be upgraded sometime over the next 6
months.
I am having an issue with file attachments for emails. Although I
didn't have problems testing, and cannot replicate the problem on my
machine, my customer keeps getting the following error.
Error Diagnostic Information
Error processing CFFILE
No data was received in the uploaded file '\' Saving empty (zero-
length) files is prohibitted. Please make sure you specified the
correct file.
The error occurred while processing an element with a general
identifier of (CFFILE), occupying do***ent position (48:4) to (48:134)
in the template file D:\INETPUB\WWWROOT\OSRMAINSITE\LIMITEDSUBS\ADMIN
\SENDEMAIL.CFM.
Date/Time: 06/18/07 16:37:48
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
The page she is trying to send from has the following code:
<form method="POST" action="SendEmail.cfm" enctype="multipart/form-
data">
<cfoutput>
<tr>
<td id="fieldName" style="padding-top:3px;">HTML Format? <input
type="checkbox" name="emailType" value="1" checked="checked" /></td>
</tr>
<tr>
<td id="fieldName" style="padding-bottom:15px;">
Add Email attachment: <input type="file" name="emailFilename"
value="">
</td>
</tr>
</cfoutput>
<cfoutput query="qryGetDeans" group="#groupName#">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'), DE('dededf'))#"
valign="top">
<td id="emailList">
<input type="checkbox" name="EmailList" value="#Email#"> #Last#,
#First#
</td>
<td id="emailList">#Email#</td>
</tr>
</cfoutput>
</form>
Originally, I thought the error was occurring because she uses a Mac,
so I added what a workaround to not upload a temp file, but today I
discovered she is having the problem on her PC as well. I checked the
page source to see if there were any unexpected characters in the
emailFilename value, but it was blank.
Here is my code for uploading a file attachment (if there is one).
<!--- check to see if there is an email attachment, if so, upload
file; also check to see if there is a file extension
".tmp" that is auto-added by the Mac when no file is selected
--->
<cfif IsDefined("FORM.emailFilename") AND ((FORM.emailFilename IS NOT
"") OR (Right(FORM.emailFilename,3) IS NOT ".tmp"))>
<cfset fileDirectory = #file_path# & 'LimitedSubs\Admin
\EmailAttachments\'>
<cftry>
<cffile action="UPLOAD" filefield="FORM.emailFilename"
destination="#fileDirectory#" nameconflict="OVERWRITE"
attributes="normal">
<cfcatch type="Application">
<cfoutput>
<!--- The diagnostic message from ColdFusion MX. --->
<p>#cfcatch.message#</p>
<p>Caught an exception, type = #CFCATCH.TYPE# </p>
<p>file variables: <br>
destination: #filedirectory#<br>
</p>
<p>The contents of the tag stack are:</p>
<cfdump var="#cfcatch.tagcontext#">
</cfoutput>
</cfcatch>
</cftry>
</cfif>
Do I need to give more information? Is it obvious to anyone what the
problem is? I don't have anyone to "2nd pair of eyes" my code, so it
could be something simple that I just don't see.
Thanks for any help!


|