2 Replies Latest reply on Aug 2, 2007 8:06 AM by alison@ut

    Uploading Multiple Images

      The answer to this question is most likely sitting right in front of me, but I can not figure this out. This is an image upload page that uploads multiple images to my SQL db. (I am using CF 7.0) I have a form called "pick.cfm" that the user enters the number of images to be uploaded. This page also sets the #cookie.micro# in the code referenced below. #cookie.micro# is the number of images to be uploaded.

      The problem is, if I upload two images, for example, named "abc.jpg" and "def.jpg" the filenames are inserted into the database as "abc.jpg" (correct) and "abc1.jpg (not correct).

      This is the form:

      <cfform action="testingform_action.cfm" enctype="multipart/form-data" method="post">

      <cfset numberoffields = #cookie.micro#>

      <cfloop index="i" from="1" to="#variables.numberoffields#" step="1">
      <cfset filename2 = "form.file">
      <cfinput type="File" name="micro" value="#variables.filename2#"/><br />


      <cfinput type="Submit" name="upload" value="upload">


      This is the action page:

      <cfloop index="i" from="1" to="#cookie.micro#" step="1">

      <cffile destination="d:\Inetpub\wwwroot\pulse\pathology\pia\images\"

      <cfquery datasource="pathimage" name="insertimage">
      Insert into images (filename) VALUES ('#file.ServerFile#')


      What is causing this? I am sure it is simple, but I can not figure it out. ANY advice you could give would be so much appreciated!