Copy link to clipboard
Copied
I using a cffileupload to upload a file into server, but the component give me an error "Status code:403". Somebody have any idea?
Copy link to clipboard
Copied
Are you running cffileupload over https? If yes, then it is a bug in ColdFusion 10.
Also, share the code?
Copy link to clipboard
Copied
thanks for your comments.
I not using HTTPS yet because I working in development enviropment, and I have coldfusion 9 and Apache in the server.
I have two files, the first have next code:
<cfoutput>
<script type='text/javascript'>
var cierra=function cerrarVentana(){
window.close();
}
var error_carga=function error(e){
alert("Estado:"+e.STATUS+"\n Mensaje: "+e.MESSAGE+"\n Archivo:"+e.FILENAME);
}
</script>
<cffileupload
url="uf_xxx.cfm?ids=#url.ids#&fe=#url.fe#&#urlEncodedFormat(session.urltoken)#"
progressbar="true"
name="upload"
addButtonLabel = "Agregar Archivo"
clearButtonlabel = "Limpiar"
hideUploadButton = "false"
width=500
height=200
title = "Carga de archivos"
extensionfilter="*.xls"
BGCOLOR="##FFFFFF"
MAXFILESELECT=1
UPLOADBUTTONLABEL="Cargar archivo"
onUploadComplete = cierra
onError=error_carga
maxuploadsize="20"
stoponerror=true
/>
the second file is uf_xxx.cfm and have the next code:
<cftry>
<cffile action="uploadAll" destination="#expandpath('../../archivo')#" nameconflict="overwrite">
<cfset stock = createObject("component","#Application.webroot#/component")>
<cfset res=stock.recibe_stock("#expandpath('../../archivo/#cffile.serverFileName#.xls')#",url.ids, url.fe)>
<cfcatch type="any">
<cfset str.STATUS = 500>
<cfset str.MESSAGE = "Error durante la carga del archivo">
<cfquery datasource="db" >
insert into logerror values(sysdate,'error', 'error')
</cfquery>
</cfcatch>
</cftry>
When I try it, the file not up and the second file not execute and in the cffileupload component appers the message "Status code: 403".
I think that is a configuration issue but I not find the solution yet.
Copy link to clipboard
Copied
Try this
<cffile action="uploadAll" destination="#expandpath('../../archivo')#" nameconflict="overwrite" accept="application/vnd.ms-excel">
Copy link to clipboard
Copied
thanks again.
I tried your suggestion but i have the same error.