bnlf
asked on
Problem with cfform encryption type + cffile
hi experts. Im having this error trying to upload a file using cffile from a cfform.
Invalid content type: application/x-www-form-url encoded.
The cffile action="upload" requires forms to use enctype="multipart/form-da ta".
i know ppl have fixed this issue using only form instead of cfform because html form you can set enctype by hand. the problem is i cant use form as my using cfselect and cfinput on my code. anyone know a workaround for this?
Invalid content type: application/x-www-form-url
The cffile action="upload" requires forms to use enctype="multipart/form-da
i know ppl have fixed this issue using only form instead of cfform because html form you can set enctype by hand. the problem is i cant use form as my using cfselect and cfinput on my code. anyone know a workaround for this?
<cfform action="include_ad.cfm" method="post">
<h2 align="center"> Incluir Anuncio </h2>
<p>Entidade: <cfinput name="entidade" type="text" autosuggest="#entities#" maxresultsdisplayed="6" required="true" message="Campo Obrigatorio" /></p>
<p>Arquivo: <cfinput name="arquivo" type="file" required="true" message="Campo Obrigatorio" /></p>
<p>Pagina: <cfselect name="nomeAd" bind="cfc:winetag.cfc.model.ad_pageService.getAllItemQuery()" display="name" value="name" bindonload="true" /></p>
<p>Altura: <cfselect name="alturaAd" bind="cfc:winetag.cfc.model.ad_pageService.getAllItemByName({nomeAd})" display="heigth" value="heigth" bindOnLoad="false" />
Comprimento: <cfselect name="comprimentoAd" bind="cfc:winetag.cfc.model.ad_pageService.getAllItemByName({nomeAd})" display="width" value="width" bindOnLoad="false" /></p>
<p><input type="submit" value="Enviar"></p>
</cfform>
-----
<cfif structKeyExists(form, "arquivo") and len(form.arquivo)>
<cffile action="upload" accept="image/jpg, image/png, image/gif, image/jpeg" filefield="arquivo" destination="#ExpandPath('../../../images/ads/#arquivo#')#" nameconflict="makeunique" >
<cfimage action="resize" width="#form.width#" height="#form.heigth#" source="#ExpandPath('../../../images/ads/#arquivo#')#" destination="#ExpandPath('../../../images/ads/#arquivo#')#" overwrite="yes">
<cfset okToContinue = True>
<cfelse>
<cfset okToContinue = False>
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
my bad. must have done something very wrong to think that enctype does not work in cfform :P
thank you that did the trick
thank you that did the trick
ASKER