3 Replies Latest reply on Jul 17, 2006 10:05 AM by JMGibson3

    Inexperienced CF Developer-Loop Logic

    jimmylharrell
      Ok I have a form that has 10 fields on it. The fields I'm primarily concerned with building my functionality with are :ImageName,Procuct,Color,Accessories. I'm basically allowing the user to upload multiple files using these fields. Someone helped me write a loop statement that made things easier and it works great.. except it only works on the image name field. I tried to do it for the other 3 but I don't understand the sytax and I need to get this done quickly. Can anyone help. Here is the code to be concerned with:

      <cfif rsUser.Name is not "" >
      <cfif isdefined("form.upload_now")>
      <cfloop index = "i" from =1 to =10>
      <cfif IsDefined("form.ImageName#i#")>
      <cfif evaluate("form.ImageName#i#") NEQ "">
      <cffile accept="image/jpeg, image/pjpeg" action="upload" destination="C:\CFusionMX7\wwwroot\winelkhybrid\images\gallery" filefield="ImageName#i#" nameconflict="overwrite">
      <cfquery name="rsGallery" datasource="connCFGallery">
      INSERT INTO Gallery ( ImageName, Approved, Name, Company, Address,
      Address2, City, State, Zip, Phone, Email, Password, Product, Color, Accessories, ReceiveNews) VALUES ( '#File.ServerFile#', '#Form.Approved#', '#Form.Name#', '#Form.Company#', '#Form.Address#', '#Form.Address2#', '#Form.City#', '#Form.State#', '#Form.Zip#', '#Form.Phone#', '#Form.Email#', '#Form.Password#', '#Form.Product#', '#Form.Color#', '#Form.Accessories#', '#Form.ReceiveNews#')
      </cfquery>
      </cfif>
      </cfif>
      </cfloop>