Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Does anyone know how to catch all Selected files from a visualforce page in its controller APEX class from:

<apex:inputFile value="{!fileName}" />

The issue is, I've implemented a file upload page but when I click its browse and select files it allows more than 1 files and when I click upload button I don't know how to reference ALL the selected files in the inputFile control.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

apex:inputFile will only upload one file at a time to the backing controller class variable.

If you want to upload multiple files at a time you will need multiple inputFile controls. For example, see Bob Buzzard Blog: Uploading Multiple Attachments via Visualforce

share|improve this answer
 
thnx @Daniel.... –  Varun Chaddha Jul 1 at 15:45
add comment

I agree with Daniel answer. You need multiple input file components to upload all files. A few things to keep note. a. Once you upload all the files, ensure that your set the file attachment to null on the controller which will help you to avoid visual state file size governor limit error.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.