+ Start a Discussion
Ravi NarayananRavi Narayanan 

Uploading Multiple Images using VisualForce

Hi,

i have a visualforce page and i am using Apex:InputFile  for uploading Image file(this image file will be stored in notes and attachments under a custom object record)   .

i have a pageblock table where the user can manualy add records . once the user click submit button, the image file name will be stored in a particular field for all these records.

Now i want to upload Multiple Images  and relate each image name with their respective records in the table.

Can someone help me with this scenario? ?  as far as i know apex:inputfile allows uploading of only one file and multiple files at a time is not possible.

 

Table:

111---------image1
144--------image1 
222-----------------image2
333-------------image3


 

Best Answer chosen by Ravi Narayanan
Sonam_SFDCSonam_SFDC
Yes, Apex:InputFile can upload one file at a time but you can create a wrapper of blob and custom object and then use repeat to upload multiple files from a single page:
reference:
http://forceguru.blogspot.in/2012/12/uploading-multiple-attachments-into.html
http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller

All Answers

Sonam_SFDCSonam_SFDC
Yes, Apex:InputFile can upload one file at a time but you can create a wrapper of blob and custom object and then use repeat to upload multiple files from a single page:
reference:
http://forceguru.blogspot.in/2012/12/uploading-multiple-attachments-into.html
http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller
This was selected as the best answer
ShashForceShashForce
Hi Ravi,

Please see if these links help:
http://bobbuzzard.blogspot.in/2011/01/uploading-multiple-attachments-via.html
http://stackoverflow.com/questions/16565737/uploading-multiple-files-in-salesforce-through-visualforce

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank