enctype="multipart/form-data" gone!

i have the code below in cflayout (center) when it submits i get the following error:

The cffile action="upload" requires forms to use enctype="multipart/form-data".

i have enctype correct as you can see but its getting lost somewhere, how? if i change the cfform to 'form' it works. why does this happen with cfform in cflayout tabs?

<cfoutput>
 
 
  
  <cfform action="includes/imageUploads.cfm" enctype="multipart/form-data" method="post" >
    <!--- Submission flag. --->
    <input type="hidden" name="submitted" value="1" />
    <!---
				Loop over the number of files we are going to
				allow for the upload.
			--->
    <cfloop index="intFileIndex" from="1" to="#REQUEST.FileCount#" step="1">
      <label for="file#intFileIndex#"> File #intFileIndex#: </label>
      <input type="file" name="file#intFileIndex#" id="file#intFileIndex#" /> 
      Alt Tag: <input type="text" name="alt#intFileIndex#" id="alt#intFileIndex#" size="30" />
 
      <br />
    </cfloop>
    <input type="submit" value="Upload Files" />
  </cfform>
</cfoutput>

Open in new window

LVL 12
pigmentartsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HuyBDCommented:
It seem the same
<cfoutput>
  <form action="includes/imageUploads.cfm" enctype="multipart/form-data" method="post" >
    <!--- Submission flag. --->
    <input type="hidden" name="submitted" value="1" />
    <!---
                                Loop over the number of files we are going to
                                allow for the upload.
                        --->
    <cfloop index="intFileIndex" from="1" to="#REQUEST.FileCount#" step="1">
      <label for="file#intFileIndex#"> File #intFileIndex#: </label>
      <input type="file" name="file#intFileIndex#" id="file#intFileIndex#" /> 
      Alt Tag: <input type="text" name="alt#intFileIndex#" id="alt#intFileIndex#" size="30" />
 
      <br />
    </cfloop>
    <input type="submit" value="Upload Files" />
  </form>
</cfoutput>

Open in new window

0
PluckaCommented:
There is nothing wrong with your code, you must have a server or other issue.

Here is my test code, I based off your code. It works perfectly.
<cfif isDefined('form.submit')>
	<cfdump var="#form#" />
	<cfabort />
</cfif>
 
<cfoutput>
	<cfform action="dmf.cfm" enctype="multipart/form-data" method="post">
		<cfloop index="intFileIndex" from="1" to="3" step="1">
			<label for="file#intFileIndex#"> File #intFileIndex#: </label>
			<input type="file" name="file#intFileIndex#" id="file#intFileIndex#" /> 
			Alt Tag: <input type="text" name="alt#intFileIndex#" id="alt#intFileIndex#" size="30" />
			
			<br />
		</cfloop>
		<input type="submit" name="submit" value="Upload Files" />
	</cfform>
</cfoutput>

Open in new window

0
PluckaCommented:
Ohh, so my page was called dmf.cfm and submits to itself.

http://code.fraser.id.au/dmf.cfm

This URL is temporary.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

pigmentartsAuthor Commented:
> Plucka

did you try it inside a CFLayout tag, i can get it to work outside but when in a cflayoutarea i get the error
0
pigmentartsAuthor Commented:
> Plucka with your code this in my dump

ALT1         [empty string]
ALT2       [empty string]
ALT3       [empty string]
FIELDNAMES       ALT1,ALT2,ALT3,SUBMIT,_CF_CONTAINERID,_CF_NODEBUG,_CF_NOCACHE,_CF_CLIENTID
SUBMIT       Upload Files
_CF_CLIENTID       6C325B28621826EC02D75BA445438CD6
_CF_CONTAINERID       centerA
_CF_NOCACHE       true
_CF_NODEBUG       true
0
PluckaCommented:
oh, what type of <CFlayout are you using?

I just changed the code to use

<cflayout type="hbox">

and it works fine still.
0
pigmentartsAuthor Commented:
ok i have done a mock up of the conditions i am using the form in and file1 is not being passed in this example either. could you try on that url? thanks
<cfajaximport tags="cfajaxproxy,cfgrid,cfform,cflayout-border,cftree,cflayout-tab,cfmenu,cftextarea,CFDIV"/>
  <cflayout type="border" >
  <!---top menu--->
  <cflayoutarea position="top">
  <cfinclude template="menus/mainMenu.cfm" />
  </cflayoutarea>
  <!---left menu--->
  <cflayoutarea position="left" name="left" title="Panel Menu" splitter="true" minsize="200"  collapsible="true" size="200" > </cflayoutarea>
  <!---main body--->
  <cflayoutarea position="center" name="center" style=" padding:1em;" > 
   <cfif isDefined('form.submit')>
        <cfdump var="#form#" />
        <cfabort />
</cfif>
 
<cfoutput>
        <cfform action="includes/imageUploads.cfm" enctype="multipart/form-data" method="post">
                <cfloop index="intFileIndex" from="1" to="3" step="1">
                        <label for="file#intFileIndex#"> File #intFileIndex#: </label>
                        <input type="file" name="file#intFileIndex#" id="file#intFileIndex#" /> 
                        Alt Tag: <input type="text" name="alt#intFileIndex#" id="alt#intFileIndex#" size="30" />
                        
                        <br />
                </cfloop>
                <input type="submit" name="submit" value="Upload Files" />
        </cfform>
</cfoutput>
  </cflayoutarea>
  <cflayoutarea position="bottom" name="mainBody" >
  </cflayoutarea>
  </cflayout>

Open in new window

0
pigmentartsAuthor Commented:
the above code i posted will not give the error but in the dump you will see no file is passed
0
PluckaCommented:
Works fine, tweaked only a bit because I dont have menu etc.
<cfif isDefined('form.submit')>
	<cfdump var="#form#" />
	<cfabort />
</cfif>
 
<cfajaximport tags="cfajaxproxy,cfgrid,cfform,cflayout-border,cftree,cflayout-tab,cfmenu,cftextarea,CFDIV"/>
  
<cflayout type="border" >
<!---top menu--->
<cflayoutarea position="top">
<h1>There</h1>
</cflayoutarea>
<!---left menu--->
<cflayoutarea position="left" name="left" title="Panel Menu" splitter="true" minsize="200"  collapsible="true" size="200" > </cflayoutarea>
<!---main body--->
<cflayoutarea position="center" name="center" style=" padding:1em;" > 
<cfif isDefined('form.submit')>
<cfdump var="#form#" />
<cfabort />
</cfif>
 
<cfoutput>
<cfform action="dmf.cfm" enctype="multipart/form-data" method="post">
<cfloop index="intFileIndex" from="1" to="3" step="1">
<label for="file#intFileIndex#"> File #intFileIndex#: </label>
<input type="file" name="file#intFileIndex#" id="file#intFileIndex#" /> 
Alt Tag: <input type="text" name="alt#intFileIndex#" id="alt#intFileIndex#" size="30" />
 
<br />
</cfloop>
<input type="submit" name="submit" value="Upload Files" />
</cfform>
</cfoutput>
</cflayoutarea>
<cflayoutarea position="bottom" name="mainBody" >
</cflayoutarea>
</cflayout>

Open in new window

0
pigmentartsAuthor Commented:
just looking at your example Plucka you now have the same problem as i have.



your code url gives this in the dump. file1 is missing! ytry uploading and no file will be uploaded

ALT1         [empty string]
ALT2       [empty string]
ALT3       [empty string]
FIELDNAMES       ALT1,ALT2,ALT3,SUBMIT,_CF_CONTAINERID,_CF_NODEBUG,_CF_NOCACHE
SUBMIT       Upload Files
_CF_CONTAINERID       center
_CF_NOCACHE       true
_CF_NODEBUG       true

you will find you can not upload using cfform. change it over to just 'form' and you will see it works. but in CF8 form

0
PluckaCommented:
Ok you are right, no upload happening, but I know why.

ID: 70006

cfinput tags with type="file" are ignored if they are in cfform
tags that are inside containers such as cfdiv, cflayoutarea,
cfwindow, and cfpod. This problem exists because ColdFusion
forms inside AJAX containers are submitted using AJAX and
there is no way to send the file contents using XMLHttpRequest. To
allow file uploading using a form in a ColdFusion AJAX container,
you must use an AJAX file upload control.

http://www.adobe.com/support/documentation/en/coldfusion/8/releasenotes.pdf

Page 3
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PluckaCommented:
So that's the answer, but not what you wanted to hear im sure.
0
pigmentartsAuthor Commented:
Plucka thanks at least i have an answer been going mad for days now. searched the net and found no answer!

ok, so is there ANY way i can do this and keep the form inside the panel without using a IFRAME. i can get it to work using a 'form' but in CF8 all form open in a new window  
0
PluckaCommented:
Hmm, it's going to be tricky. You could eiher pop open a seperate window or use an iframe. There might be a flash / flex option also.

Why don't you like the <iframe method, just for upload fields at least.
0
pigmentartsAuthor Commented:
i have had problems in the pass with iframes and security so stayed away form when for years. maybe its time to revisit.

thank you for taking the time to help me sort this problem Plucka you have been a big help.
0
PluckaCommented:
Happy you know the reason at least.
0
pigmentartsAuthor Commented:
Very helpful, thanks for taking the time, i know i dont alway fully explain my self correctly.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.