ADOBE! - CFwindow and Cffile
this has been posted before - but without an "answer" - simply an "ugly" woraround...
http://forums.adobe.com/message/2774350
I am having the SAME issue - and would really like an answer as to why or what is needed in order to make the cfwindow and built in ajax handle a the cfforms attributes correctly...
this issue is trying to upload Images through a cffile in a CFWINDOW and I keep getting the below error
"Invalid content type: application/x-www-form-urlencoded; charset=UTF-8"
"The cffile action="upload" requires forms to use enctype="multipart/form-data".
The cfform file is already set to "enctype="multipart/form-data".
CODE calling the window
==== BEGIN PAGE ====
<html>
<head>
<script>
function launchWin(name,url) {
ColdFusion.Window.create(name+'_formWindow', name, url,
{ height:500,
width:500,
modal:true,
closable:true,
draggable:true,
resizable:true,
center:true,
initshow:true,
minheight:200,
minwidth:200
})
}
</script>
</head>
<body>
<cfdiv id="myContent">
<a href="javascript:launchWin( 'Attachment', 'attachment.cfm?' );" >ATTACHMENT</a>
<!--- other code blah blah --->
</cfdiv>
</body>
</html>
==== END PAGE ====
Here is the simple code... for the file INSIDE the cfwindow
==== BEGIN PAGE ====
<script>
ColdFusion.Window.onHide( 'Attachment_formWindow', cleanup );
function cleanup() {
ColdFusion.Window.destroy( 'Attachment_formWindow', true );
}
</script>
<!--- HANDLE THE FORM --->
<cfif structKeyExists( FORM, 'add_Attachment' ) >
<!--- Do CFFILE to handle file upload --->
<cffile action="upload"
destination="C:\"
filefield="theFile"
nameconflict="makeunique">
<!--- refresh the calling page, and close this window - destroy it so contents don't presist --->
<script>
ColdFusion.navigate( 'page.cfm?', 'myContent' );
ColdFusion.Window.hide( 'Attachment_formWindow' );
</script>
</cfif>
<!--- form to get information --->
<cfform name="attachmentForm" enctype="multipart/form-data" >
<table>
<tr><td>FILE:</td><td><cfinput type="file" name="theFile" size="40" /></td></tr>
<tr><td>TITLE:</td><td><cfinput type="text" name="name" value="" size="40" maxlength="100" /></td></tr>
<tr><td>DESCRIPTION:</td><td><cftextarea name="description" cols="40" rows="10"></cftextarea></td></tr>
<tr><td></td><td><cfinput type="submit" name="add_Attachment" value="Add" /></td></tr>
</table>
</cfform>
==== END PAGE ====
