Hello experts.
I'm using a page with all the upload code and validation and one page with the upload form and the error output.
The problem i have is that i'm not getting the errors on the upload page.
The page with the upload and validation code is like:
uploadcode.cfm:
<cfparam name="errors" default="">
<CFSET thispath = expandpath("./images")>
<cfif structKeyExists(form,"foto
1") and len(form.foto1)><!--- uploads a file to our website --->
<CFFILE action="upload" filefield="foto1" destination="#thispath#" nameconflict="MAKEUNIQUE">
<cfif file.Filesize GT 100 * 1024>
<cffile action="delete" file="#thispath#/#cffile.s
erverfile#
">
<cfset errors = errors & "Image is too big!<br />">
<cfelseif Lcase(file.ClientFileExt)N
EQ "gif"
AND Lcase(file.ClientFileExt) NEQ "jpg"
AND Lcase(file.ClientFileExt) NEQ "jpeg">
<cffile action="delete" file="#thispath#/#cffile.s
erverfile#
">
<cfset errors = errors & "Image 1 is not gif or jpg or jpeg!">
<cfelse>
<cfimage name="uploadedImage"
source="#thispath#/#cffile
.serverFil
e#" ></cfif>
The page with the uploadform is like:
uploadpage.cfm:
<cfif CGI.REQUEST_METHOD IS "POST">
<cfinclude template="Includes/uploadc
ode.cfm">
<cfquery ..........
........
<cfparam name="errors" default="">
before the form:
<cfif errors neq "">
<div><table cellspacing="0" cellpadding="0" class="Tablewarnings">
<tr>
<td><img src="img/warning.png" /></td>
<td><cfoutput>
<p>
<b>Please check out these errors:<br />
#errors#
</b>
</p>
</cfoutput></td>
</tr>
</table>
</div></cfif>
The validation is working but i think that the uploadpage does not see any errors and i have no output if validation fails.
Any help?
Start Free Trial