SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict macker123's Avatar
    Join Date
    Mar 2000
    Location
    Victoria, BC
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with multiple image upload

    I have a script I purchased and it currently only uploads one image file at a time. I am having trouble modifying it so I can upload say 5 or 10 at once by having 5 or 10 text boxes with just one submit button. Can somebody please help me.

    Here is my code. Thanks for your help, this is all I am waiting on then I can launch my site.

    Code:
    <CFIF IsDefined("Cookie.Cookie_MemberID")>
    	<CFSET Authenticated="true">
    <CFELSE>
    	<CFLOCATION URL="index.cfm?memo=1">
    </CFIF>
    
    <CFPARAM NAME="Memo"      DEFAULT="">
    <CFPARAM NAME="SizeTotal" DEFAULT="0">
    <CFPARAM NAME="FileSize"  DEFAULT="0">
    <CFPARAM NAME="FolderID"  DEFAULT="">
    
    
    <CFIF #ParameterExists(formsubmit)#>
    
    	<CFFILE ACTION="Upload"
    		FILEFIELD="filecontents"
    	    	DESTINATION="#filePath#\uploads\"
    	    	NAMECONFLICT="overwrite"
    	    	ACCEPT="image/gif, image/pjpeg">
    	
    	<!-- Rename Filename to make unique -->		
    	<cffile action="rename"
    		source="#filePath#\uploads\#File.ClientFile#"
    		destination="#filepath#\uploads\#Cookie.Cookie_MemberID#_#File.ClientFile#"> 
    	
    	<!-- Convert File size from bytes to kilobytes -->
    	<CFSET FileSize = (File.FileSize / 1000)>
    	
    	<CFIF FolderID EQ "">
    		<CFSET FolderID = "0">
    	</CFIF>
    
    	<CFQUERY DATASOURCE="#DSN#">
    		INSERT INTO Images (MemberID, FileName, FileSize, FolderID)
    		VALUES (#Cookie.Cookie_MemberID#, '#Cookie.Cookie_MemberID#_#File.ClientFile#', '#FileSize#', #FolderID#)
    	</CFQUERY>
    
    	<!-- Get Total Bytes Used -->
    	<CFQUERY NAME="GetImages" DATASOURCE="#DSN#">
    		SELECT FileSize
    		FROM Images
    		WHERE MemberID = #Cookie.Cookie_MemberID#
    	</CFQUERY>
    	
    	<CFLOOP QUERY="GetImages">
    		<CFSET SizeTotal = (FileSize + SizeTotal)>
    	</CFLOOP>
    
    	<!-- Convert from Bytes to Kilobytes -->
    	<CFSET SizeTotal = (SizeTotal / 1000)>
    	
    	<CFIF SizeTotal GT #RegularUploadLimit#>
    		<CFQUERY DATASOURCE="#DSN#">
    			UPDATE Members
    	       		SET Limitexceeded=1
    	       		WHERE MemberID = #Cookie.Cookie_MemberID#
    		</CFQUERY>
    	</CFIF>
    
    	<CFLOCATION URL="manager.cfm">
    
    </CFIF>
    
    
    <CFQUERY NAME="GetFolders" DATASOURCE="#DSN#">
    	SELECT FolderID, FolderName
    	FROM Folders
    	WHERE MemberID = #Cookie.Cookie_MemberID#
    </CFQUERY>
    <html>
    <head>
    <title>myPhotoDrive - Image Hosting Has Never Been This Easy!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
              <!--- START TOP NAV BARS --->
              <CFINCLUDE TEMPLATE="includes/include_topnavs.txt">
              <!--- END TOP NAV BARS --->
    <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="150" height="328" valign="top" background="images/left-bg2-left.png" bgcolor="#E7DFD6" class="lefttd" style="padding-left: 3px;"><div align="center">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="120" bgcolor="#000000"> <table height="120" border=0 cellpadding=5 cellspacing=1>
                    <tbody>
                      <tr> 
                        <td valign=top height=118 background="images/left-bg2-left.png"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;<b>Uploading 
                          your images:</b><br>
                          &nbsp;<b>1. </b><span class=copyright>Use the form on the 
                          right to upload your images for hosting</span>.<br>
                          &nbsp;<b>2. </b><span class=copyright>Your account is<cfoutput> 
                            #NumberFormat(GetSettings.RegularUploadLimit / 1000)#</cfoutput> 
                          mb's in size.</span> </font></td>
                      </tr>
                    </tbody>
                  </table></td>
              </tr>
            </table>
          </div></td>
        <td width="7" valign="top" background="images/left-bg.png" class="lefttd">&nbsp;</td>
        <td valign="top" background="images/body-bg.png" class="bodytd"> 
              <p>
                                      
          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr> 
              <td> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                <!--- START TOP NAV BARS --->
                <CFINCLUDE TEMPLATE="includes/include_modules.txt">
                <!--- END TOP NAV BARS --->
                </font></td>
            </tr>
            <tr> 
              <td> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                <!--- START SECTION CONTENT --->
                <B>Upload an Image</B> </font> <P> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <CFIF GetUser.LimitExceeded EQ "0">
                    <B>Instructions:</B> 
                  </CFIF>
                  </font> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <CFIF GetUser.LimitExceeded EQ "0">
                  </CFIF>
                  </font> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <cfif GetUser.LimitExceeded EQ "0"> 
                </font> <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  To upload an image, click on the browse button.<br>
                  Then select the image filename from your hard drive.<br>
                  Last, click upload to store your image. </font> 
                <p> 
                <form action="upload.cfm" method=POST enctype="multipart/form-data">
                  <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <input type="hidden" name="formsubmit" value="True">
                  <input type="hidden" name="FileContents_Required" value="You must select a file"">
                  <cfif GetFolders.RecordCount NEQ "0">
                  </cfif>
                  </font> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <cfif GetFolders.RecordCount NEQ "0">
                  </cfif>
                  </font> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <cfif GetFolders.RecordCount NEQ "0">
                  </cfif>
                  </font> <font size="2"> 
                  <cfif GetFolders.RecordCount NEQ "0">
                  </cfif>
                  </font> 
                  <cfif GetFolders.RecordCount NEQ "0">
                    <table>
                      <tr> 
                        <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Upload 
                          to Folder</font></td>
                        <td> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                          <select name="FolderID">
                            <option value="">None <cfoutput query="GetFolders"> 
                              <option value="#FolderID#">#FolderName#</option>
                            </cfoutput> 
                          </select>
                          </font></td>
                      </tr>
                    </table>
                  </cfif>
                  <p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                    <input type="File" name="filecontents" size="40">
                    <input type="submit" value="Upload" name="submit">
                    <br>
                    *Only images of type GIF, JPG and JPEG are accepted.</font> 
                </form>
                <font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                <cfelse>
                <font color="red">Storage limit exceeded. You must delete images before 
                adding more.</font></font> <p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"></cfif> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                  <!--- END SECTION CONTENT --->
                  </font></td>
            </tr>
          </table>
                                      </td>
      </tr>
    </table>
    <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><a href="http://www.suncitydesign.com"><img src="images/footer.png" alt="Designed by: Sun City Design (www.suncitydesign.com)" width="700" height="40" border="0" /></a></td>
      </tr>
    </table>
    <br />
    </body>
    </html>

  2. #2
    SitePoint Addict macker123's Avatar
    Join Date
    Mar 2000
    Location
    Victoria, BC
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had somebody solve this for me. Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •