Uploading multiple files to server path in Oracle ADF using af:inputFile

Sharing is Caring

Hello All 🙂

Previously I have posted about uploading and downloading files from server path (Refer this post for more clarification), In that post I have described the process of uploading single file at a time but sometimes we need to upload multiple files at a time and for that requirement we can use same code with little modification

So In this post we’ll see that how can we upload multiple files at a time using af:inputFile, Here I am using same sample application that is used in previous post

Default inputFile source looks like this

<af:inputFile label="Select" id="if1" valueChangeListener="#{viewScope.FileUploadDownloadBean.uploadFileVCE}"


To enable multiple files selection in af:inputFile we have to set some properties

<af:inputFile label="Select" id="if1"
autoSubmit="true" rows="5" maximumFiles="5"/>

and what rows and maximumFiles properties mean?

rows int Yes an attribute that determines the number of rows in the file list. There will be a scrollbar which will be displayed when the number of files exceeds this number.


maximumFiles int Yes an attribute that is used to restrict the number of files a user can upload. If the user tries to upload more files than specified in maximumFiles then an error is returned. If maximumFiles is less than 1 then the number of files is unlimited.

After setting these properties inputFile looks like this

Uploading multiple files

Now UI part is done , next is code part so to get and upload multiples files from client we have to use a List data structure and then in value change listener we’ll traverse that List and upload all files to server path.

ValueChangeListener of af:inputFile-

    /*****Generic Method to Get BindingContainer**/
    public BindingContainer getBindingsCont() {
        return BindingContext.getCurrent().getCurrentBindingsEntry();

* Generic Method to execute operation
* */
public OperationBinding executeOperation(String operation) {
OperationBinding createParam = getBindingsCont().getOperationBinding(operation);
return createParam;


/**Method to Upload Multiple Files ,called on ValueChangeEvent of inputFile
* @param vce
public void uploadFileVCE(ValueChangeEvent vce) {
if (vce.getNewValue() != null) {
//Get File Object from VC Event
List<UploadedFile> lf = (List<UploadedFile>) vce.getNewValue();

//Traverse over file list to upload all files
for (UploadedFile fileVal : lf) {
//Method to check if this file is uploaded previously or not
OperationBinding duplOb = executeOperation(“checkDuplicateFile”);
duplOb.getParamsMap().put(“fileNm”, fileVal.getFilename());
if (duplOb.getResult() != null && “Y”.equalsIgnoreCase(duplOb.getResult().toString())) {

//Upload File to path- Return actual server path
String path = uploadFile(fileVal);
//Method to insert data in table to keep track of uploaded files
OperationBinding ob = executeOperation(“setFileData”);
ob.getParamsMap().put(“name”, fileVal.getFilename());
ob.getParamsMap().put(“path”, path);
ob.getParamsMap().put(“contTyp”, fileVal.getContentType());

// Reset inputFile component after upload


AMImpl Method to check duplicate file-


    /**Method to check for duplicate files
     * @param fileNm
     * @return
    public String checkDuplicateFile(String fileNm) {
        ViewObject fileVo = this.getFileUpdDwn1();
        Row duplFile[] = fileVo.getFilteredRows("FileName", fileNm);
        if (duplFile.length > 0) {
            return "N";
        } else {
            return "Y";

For other methods and DB table refer previous post Uploading and downloading files from absolute server path
So All done for multiple files upload now run and check application

Sample ADF Application (Jdeveloper 12.1.3)- Download
Cheers 🙂  Happy Learning

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

33 thoughts on “Uploading multiple files to server path in Oracle ADF using af:inputFile”

  1. Hi Sir,

    I have a concern irrespective to this blog. Actually when i run my application on integrated weblogic in jdeveloper 12c it got deployed(run) successfully but when 2nd time when i run the same application rather then redeploying, it got undeployed. Am facing this issue on alternate basis everytime and on every machine.

    Thanks in advance.

  2. nice work Ashish
    But i have a small problem
    when i upload *.txt or *.csv or * .jpg …etc. i can see the file content in inlineFrame without any problems, but when i upload *.docx or *.xlsx and click on the file to see it's content i get download operation with Zip file and this zip file has the same name of the servlet

  3. thanks ashish
    but I have another problem
    when I apply this post in Jspx page it was working fine
    but when I try to apply it into jsff page(dynamic region with task flow)
    I got this error

    "#{bindings.dynamicRegion1.regionModel}" (that was specified for the RegionModel "value" attribute of the region component with id "r1") evaluated to null.
    This is typically due to an error in the configuration of the objects referenced by this expression.
    If it helps, the expression "#{bindings.dynamicRegion1}" evaluates to "null".
    If it helps, the expression "#{bindings}" evaluates to "null". Now using an empty RegionMode

  4. hi Sir,

    I would like to save to DB using a button, not as the above, would you please advise how to separate above code

    //Method to insert data in table to keep track of uploaded files
    OperationBinding ob = executeOperation("setFileData");
    ob.getParamsMap().put("name", fileVal.getFilename());
    ob.getParamsMap().put("path", path);
    ob.getParamsMap().put("contTyp", fileVal.getContentType());

    thank you 🙂

  5. Hi Ashish,

    I have referred your sample for multiple file upload,
    When I am uploading 11 files its sucessfull
    When I am uploading 25 + files it is throwing 503 error(A connection to server has failed : Status 503)
    in the log file I am seeing some multithreading issue.
    Can you help in this regard, how to escape from 503 error.


Leave a Reply

Your email address will not be published. Required fields are marked *