Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one registration form in which i want user to add image to database. but i want user can select only 5 images maximum, I am using file upload but it takes only 1 photo at a time. Should i take 5 file uploads? but it doesn't looks good. Tell me some suggestions.
Posted

 
Share this answer
 
v3
Comments
Raj Negi 4-Apr-14 3:51am    
i want to store images in database.
Since you are using jQuery: Multiple File Upload Using jQuery[^]
 
Share this answer
 
Comments
Raj Negi 4-Apr-14 3:52am    
i want to store images in database.
OriginalGriff 4-Apr-14 4:17am    
And you have my permission...

Have a look at this:
http://www.codeproject.com/Tips/465950/Why-do-I-get-a-Parameter-is-not-valid-exception-wh
It explains how to store an image.
just use
ajax FileUpload with Demonstration
 
Share this answer
 
v2
You can set the MultiSelect property to 'true'. See example:-

C#
OpenFileDialog selectImages = new OpenFileDialog();
selectImages.Filter = "All files|*.*"; //"JPEG|*.jpg"; if you want only one format.
selectImages.Multiselect = true;
if (selectImages.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
    foreach (string fileName in selectImages.FileNames)
    {
       // ... keep your code here to save images to DB one by one...
    }
}
 
Share this answer
 
Set
HTML
MultiSelect="true"
 
Share this answer
 
Not Effective response. Now i am taking 5 Seperate fileupload to store images.
Thank You
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900