...

View Full Version : ColdFusion - Problem with file fields and <CFfile>



coder_seth
02-15-2004, 11:20 PM
Error Diagnostic Information

Error in CFFILE tag

The form field specified in the CFFILE tag (IMG_INPUT) does not contain an uploaded file. Please be sure that you have specified the correct form field name.

The error occurred while processing an element with a general identifier of (CFFILE), occupying document position (33:5) to (33:120).

Date/Time: 02/15/04 17:17:45
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Query String: edit_home=y

=============================================

I get the same error in IE6. i have made sure that my file field name in the form and attribute in the <CFfile> tag are the same. I've been staring at this for some time, and I'm sure it's something simple, but I'm just not seeing it for whatever stupid reason. I'm using CF 4.5. The CFX tag is a cutstom third party tag that handles image resizing and such. Here's my markup. It's giving me the error on the sixth line:



<CFparam name="submitted" default="">
<CFif submitted is "y">

<CFif img_input NEQ "">
<!--- Upload the new image to a temporary folder --->
<CFfile destination="#upload_path#" action="upload" nameconflict="overwrite" filefield="img_input" accept="image/*">
<!--- sets the path to the temporary upload spot for reference when deleting it later --->
<CFset temp = upload_path & file.ServerFile>

<!--- This custom tag will be used to check the width and height of the uploaded images.
If they are illegal sizes, ImageCR3 will work its mojo on the big *** files --->
<CFX_imginfo name="img_info" filename="#upload_path##FILE.ServerFile#">

<!--- Make sure the final file name is all lowercase --->
<CFset FileName = #LCase(file.ServerFile)#>

<!--- ImageCR 3 resizes the large version if it's too large --->
<CFif #img_info.width# GT 376>
<CFX_imageCR3 load="#upload_path##file.ServerFile#" save="#home_img_path##FileName#" resize="376" format="jpg" quality="70">
<CFelse>
<CFX_imageCR3 load="#upload_path##file.ServerFile#" save="#home_img_path##FileName#" format="jpg" quality="70">
</CFif>

<CFset img = #imagecr.filename#>

<!--- Delete the temp upload --->
<CFfile action="delete" file="#temp#">
</CFif>

<CFquery name="update_home" datasource="#datasource#">
UPDATE home
SET
header = '#header#',
body = '#body#'
<CFif img_input NEQ "">
,img = '#img#'
</CFif>
WHERE ID = #ID#
</CFquery>

<h2>Home Page Edited</h2>
<p>Here is the current home page:</p>
<div class="float_right" style="width: 376px; margin: 0px 0px 10px 10px;">
<img src="../images/#get_home.img#" alt="Welcome to Dan's Southside Marine" /><br />
</div>
<h1>#get_home.header#</h1>
<p>#Replace(get_home.body,Chr(13),"<br />","ALL")#</p>

<CFelse>

<form id="admin_edit_home" method="post" action="admin.cfm?edit_home=y">
<div><label for="header">Header:</label><input type="text" name="header" id="header" value="#get_home.header#" /></div>
<div>
<label for="body">Body:</label>
<textarea name="body" id="body" rows="7" cols="">#get_home.body#</textarea>
</div>
<h2>Edit Image</h2>
<div>
<p><img src="../images/#get_home.img#" alt="Welcome to Dan's Southside Marine" /></p>
<p>To change the image for the home page, select a new file by clicking "Browse" below. The image can be any size. It will be resized to fit your home page upon upload. To leave the image as is, just ignore this input field.</p>
<input type="file" name="img_input" id="img_input" />
<input type="hidden" name="ID" value="#get_home.ID#" />
</div>
<div><input type="submit" name="update" value="Update" class="button" /><input type="button" name="cancel" value="Cancel" onClick="document.location='javascript:history.back();';" class="button" /></div>
<input type="hidden" name="submitted" value="y" />
</form>

</CFif>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum