0 Replies Latest reply on Sep 2, 2009 12:38 PM by rmorgan

    Wizard back stepping

    rmorgan Level 1

      Hi,

      I have a wizard style form that I am having a small issue with. As the user steps through the process there is a point that a file can be uploaded and then continue on. I am wanting to set a size limit on the file which I think I have working fine. But what I want the form to do is backup to the page with the file selection page if the file exceeds my limit and display a message stating the error so that they can correct the issue.

       

      I have this:

      Step 1: fill in data - submit

      Step 2: set session vars from step 1 - fill in more data - submit

      Step 3: set session vars from step 2 - fill in more data - submit

      Step 4: set session vars from step 3 - fill in more data - upload file - submit

      Step 5: set session vars from step 4 - fill in more data - submit

      Step 6: set session vars from step 5 - fill in more data - submit and write all session var data to DB

       

      I need step 5 to check file size and if exceeds the set limit to backup to Step 4 with a message and still hold all data that was entered.

      Here is my current code.

       

      Step 4: code

      <other input field>

      <other input field>

      <other input field>

      <other input field>

      <other input field>

      Only image files will be accepted.<br>

      Filesize must not exceed 1 megabyte.<br>
        <cfinput type="file" name="imagefile" >


      Step 5 code(upload portion of code):

      <cfif isDefined("Session.imagefile") and #Session.imagefile# neq "" >
      <cffile action = "upload" fileField = "imagefile" destination="#ExpandPath("upload")#" nameConflict = "MakeUnique" accept="image/jpg, image/jpeg, image/pjpeg, image/gif"  >
      <cfset Session.serverfile = "#cffile.serverfile#">
      <cfif (CFFILE.FileSize GT (1024 * 1024))>
      <cffile action="delete"  file="#ExpandPath("upload")#/#Session.serverfile#">

      need to backup one step here

      </cfif>

      </cfif>

       

      Back to Step 4:

      All other fields are still holding info previously entered

       

      Only image files will be accepted.<br>

      Filesize must not exceed 1 megabyte.<br>

      Your file exceeds the filesize limit, please resize
         <cfinput type="file" name="imagefile" >

       

      TIA