5

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.

8

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

  • thnx @Daniel.... – VarunC Jul 1 '13 at 15:45
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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