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="" 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=""<cfif url.area is "home_slides"> selected="selected"</cfif>>Home Slideshow</option>
        <option value=""<cfif url.area is "home_buttons"> selected="selected"</cfif>>Home Buttons</option>
        <option value=""<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=""><img src=",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

Who is Participating?
_agx_Connect With a Mentor Commented:
> <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))>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.