[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now



Posted on 2012-08-22
Medium Priority
Last Modified: 2012-08-22
No matter what I do, I can't seem to locate the error that's causing this.  I commented out the DIV set where the form resides in case it was creating an issue with the error, but still keep getting the same error. I've spent nearly 3 hours combing through my code and still no resolve.


Invalid content type: ''.  
The cffile action="upload" requires forms to use enctype="multipart/form-data".  
The error occurred in C:\domains\restorationlutherancom\admin\photo_uploads.cfm: line 31
29 :   <cffile action="upload"
30 :      fileField="ifile"
31 :      destination="C:\domains\restorationlutheran\images\tempUpload\" nameconflict="makeunique" accept="image/jpeg">
32 :             <cfif cffile.filesize gt 200 * 1024>
33 :         <cffile action="delete" file="C:\domains\restorationlutheran\images\tempUpload\#cffile.serverfile#">

<cfparam name="url.area" default="home_slides">
<cfparam name="url.imgid" default="">
<cfparam name="form.area" default="#url.area#">
<cfparam name="form.ifile" default="">
<cfparam name="err1" default="">
<cfparam name="c1" default="">
<cfif url.area is "home_slides">
<cfset idesc="JPG Format - 72dpi, 850px wide by 233px tall">
<cfdirectory action="list" directory="c:\domains\restorationlutherancom\images\user\rot\" sort="asc" name="il" filter="*.jpg">
<cfset ip="/images/user/rot/">
<cfset cip="\images\user\rot\">
<cfset sti=1>
<cfelseif url.area is "home_buttons">
<cfset idesc="JPG format - 72dpi, 240px wide by 180px tall">
<cfdirectory action="list" directory="c:\domains\restorationlutherancom\images\buttons\" sort="asc" name="il" filter="*.jpg">
<cfset ip="/images/buttons/">
<cfset cip="\images\buttons\">
<cfset sti=1>
<cfelseif url.area is "article">
<cfset idesc="JPEG format - 72dpi, 240px wide by 180px tall">
<cfdirectory action="list" directory="c:\domains\restorationlutherancom\images\articles\" sort="asc" name="il" filter="*.jpg">
<cfset ip="/images/articles/">
<cfset cip="\images\articles\">
<cfset sti=0>
<cfparam name="idesc" default="">

<cfif isDefined("ifile")>
  <cffile action="upload"
     destination="C:\domains\restorationlutheran\images\tempUpload\" nameconflict="makeunique" accept="image/jpeg">
		<cfif cffile.filesize gt 200 * 1024>
        <cffile action="delete" file="C:\domains\restorationlutheran\images\tempUpload\#cffile.serverfile#">
        <cfset err1="The file you uploaded exceeded 150kb. Please ensure the file meets the upload requirements.">
        <cfset c1="The file was uploaded.">
<!doctype html>
<html  lang="en">
  <meta charset="utf-8">
 <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<title>RLC - Admin - Photo Upload Page</title>
<!--- <script src="includes/SpryCollapsiblePanel.js" type="text/javascript"></script>
<link href="includes/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" /> --->
<link href="http://www.restorationlutheran.com/includes/css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  if (restore) selObj.selectedIndex=0;


<!--- <div id="CollapsiblePanel1" class="CollapsiblePanel">
  <div class="CollapsiblePanelTab" tabindex="0"><h1>IMAGE ADMIN PAGE</h1></div>
  <div class="CollapsiblePanelContent"> --->
<FORM method="post" enctype="multipart/form-data">  
  <table width="100%" border="0" cellspacing="0" cellpadding="3" class="black12">
    <td width="14%" align="right" bgcolor="#CCCCCC">Select Area of Site:</td>
    <td colspan="2" bgcolor="#CCCCCC">
      <select name="area" id="area" onchange="MM_jumpMenu('parent',this,0)">
        <option value="http://www.restorationlutheran.com/admin/photo_uploads.cfm?area=home_slides"<cfif url.area is "home_slides"> selected="selected"</cfif>>Home Slideshow</option>
        <option value="http://www.restorationlutheran.com/admin/photo_uploads.cfm?area=home_buttons"<cfif url.area is "home_buttons"> selected="selected"</cfif>>Home Buttons</option>
        <option value="http://www.restorationlutheran.com/admin/photo_uploads.cfm?area=article"<cfif url.area is "article"> selected="selected"</cfif>>Article Image</option>
      </select><CFOUTPUT>* #idesc#</CFOUTPUT></td>
    <td align="right" valign="top">Existing Images:<br>
      <hr /><cfif sti is 1>Please select an image to replace<cfelse>Please upload a new image according to the specifications listed for this area of the site. If the image you want is already displayed to the right, there is no need to duplicate the upload. Please use the ARTICLE ADMIN PAGE to select that image for your article.</cfif>
    <td colspan="2"><div id="uploaded_images"><cfif il.recordcount gt 0><cfoutput query="il"><a href="http://www.restorationlutheran.com/admin/photo_uploads.cfm?area=#url.area#&imgid=#ip##name#"><img src="http://www.restorationlutheran.com#ip##name#?#randrange(1,400)#" class="thumbs"  <cfif url.imgid is "#ip##name#">style="border:4px red solid"</cfif>/></a></cfoutput><cfelse><h2>THERE ARE NO IMAGES TO DISPLAY AT THIS TIME</h2></cfif></div>
<cfif form.ifile is "" AND err1 is "">
    <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Select File to Be Uploaded:</td>
    <td width="36%" bgcolor="#CCCCCC">
      <input type="file" name="ifile" id="ifile" /></td>
    <td width="50%" bgcolor="#CCCCCC">&nbsp;</td>
<cfelseif not err1 is "">
    <td align="right" nowrap="nowrap" bgcolor="#CCCCCC">Select File to Be Uploaded:</td>
    <td width="36%" bgcolor="#CCCCCC">
      <input type="file" name="ifile" id="ifile" /><cfoutput>#err1#</cfoutput></td>
    <td width="50%" bgcolor="#CCCCCC">&nbsp;</td>
<cfelseif not c1 is "">
<tr><td colspan="2">#c1#</td></tr>
    <td align="right">&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="upload image" /><INPUT name="imgname" type="hidden" value="<CFOUTPUT>#url.imgid#</CFOUTPUT>" /></td>
<!--- </div>

<script type="text/javascript">
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1");
</script> --->

Open in new window

Question by:day6
1 Comment
LVL 52

Accepted Solution

_agx_ earned 2000 total points
ID: 38323247
> <cfif isDefined("ifile")>

The problem is line 28.  Because you already defined that variable on line 4:

              <cfparam name="form.ifile" default="">

The variable always exists. So CF tries to run the upload code before anything is uploaded, causing the error you see. To fix it, add an extra check to make sure the variable isn't empty and it should work correctly.

           <cfif isDefined("form.ifile") AND len(trim(form.ifile))>

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question