473,414 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Multiple image upload form

How do i allow users to upload a minimum of 1 and maximum of 10 images? What is the best way to code this solution?
Mar 13 '10 #1
3 4396
acoder
16,027 Expert Mod 8TB
In your HTML code, have up to 10 input file fields with different names, e.g. file1, file2. A loop may help here, and you could keep a count or just make sure the files are numbered sequentially. You could improve this by only showing one and an add button for the rest up to a maximum of 10.

On the server-side, use a loop for each upload file. If one doesn't exist, stop. Here you could use the count, but don't necessarily depend on it.

If you need any help with the coding, post your code.
Mar 15 '10 #2
Give the CFMU project a try: http://cfmu.riaforge.org/

Also, Coldfusion 9 has a built-in multiuploader: http://www.remotesynthesis.com/post....n-9-in-5-lines
Mar 19 '10 #3
I usually just put all 10 file fields on the page and then if they want to only use 1 then my server-side code checks to see if that field's value is an empty string.

Client Side:
Expand|Select|Wrap|Line Numbers
  1. <input type="file" id="fileImage1" name="fileImage1" class="small_text" size="60" /><br />
  2.                         <input type="file" id="fileImage2" name="fileImage2" class="small_text" size="60" /><br />
  3.                         <input type="file" id="fileImage3" name="fileImage3" class="small_text" size="60" /><br />
  4.                         <input type="file" id="fileImage4" name="fileImage4" class="small_text" size="60" /><br />
  5.                         <input type="file" id="fileImage5" name="fileImage5" class="small_text" size="60" /><br />
  6.                         <input type="button" name="btnAddImages" value="Add Images" class="small_text" onclick="validateAdd();" />
  7.  
Server Side:
Expand|Select|Wrap|Line Numbers
  1. <cfif FORM["fileImage1"] IS NOT "">
  2.                 <cffile action="upload" filefield="FORM.fileImage1" destination="#strServerDir#">
  3.             </cfif>
  4.             <cfif FORM["fileImage2"] IS NOT "">
  5.                 <cffile action="upload" filefield="FORM.fileImage2" destination="#strServerDir#">
  6.             </cfif>
  7.             <cfif FORM["fileImage3"] IS NOT "">
  8.                 <cffile action="upload" filefield="FORM.fileImage3" destination="#strServerDir#">
  9.             </cfif>
  10.             <cfif FORM["fileImage4"] IS NOT "">
  11.                 <cffile action="upload" filefield="FORM.fileImage4" destination="#strServerDir#">
  12.             </cfif>
  13.             <cfif FORM["fileImage5"] IS NOT "">
  14.                 <cffile action="upload" filefield="FORM.fileImage5" destination="#strServerDir#">
  15.             </cfif>
  16.  
Oct 28 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
0
by: dann2 | last post by:
hello, i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this: ... '<% ' Create an instance of AspUpload object 'Set...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
6
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
I am developing a administrative backend for our sales dept website. They are using admin forms to manipulate what is displayed for the end user on the site. I am running into a problem with a form...
16
ribbo
by: ribbo | last post by:
What I need in a nutshell is a form that will allow me to upload multiple pictures (say 5) to my server while at the same time saving the names to the MySQL database. I would prefer it if the image...
1
by: sravani1 | last post by:
This code runs like when i submit the form it takes the image and displayed and top of the image a map will displayed. But actually i want that when i give the image it checks the location in the map...
1
by: =?Utf-8?B?UmFqYWdvcGFs?= | last post by:
Question How to Upload multiple images in asp.net? (ex.Like a gmail file field)
8
johngault
by: johngault | last post by:
I've been working with this PHP page for several days now and I'm stumped. The page is supposed to allow the user to upload up to six images for their profile. When the user adds an image it (the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.