Skip to content Skip to sidebar Skip to footer

Upload Multiple Files With Ajaxfileupload With Different File Ids

I am trying to upload multiple files in the same form. Multiple files should be in different fields. I used ajaxfileuploader for single file and receive it using MultipartHttpServl

Solution 1:

You can wrap that code in a function and call it multiple times since the plugin doesn't support multiple elements in once request

var uploadFile = function (elementID) {
    $.ajaxFileUpload({
        url: 'uploadfile',
        secureuri: false,
        fileElementId: elementID,
        dataType: 'text',
        data: {
            id: id
        },
        success: function (data, status) {
            if (status == 'success') {
                return;
            } else {}
        },
        error: function (data, status, e) {
            returnalert('Error ! Failed to upload file!');
        }
    });
};

Then use it this way

uploadFile('file1');
uploadFile('file12');

Solution 2:

Post a Comment for "Upload Multiple Files With Ajaxfileupload With Different File Ids"