0

I am using jqgrid, and I need to upload files from two different inputs using one ajax file upload call. I can upload one file using the fileElementId, but is there any way to upload two files simultaneously?

function uploadFiles(dfcId) {
    $.ajaxFileUpload({
        url: '/DigitalFileCabinet/UploadFile',
        type: 'POST',
        dataType: 'json',
        secureuri: true,
        async: false,
        data: { id: dfcId },
        fileElementId: "file1",
        success: function (response, status) {
            //success code
        },
        error: function (data, status, e) {
            if (status === 'success')
                return;
            else
                return alert('Failed to upload PDF!');
        }
    });
};

I have tried the following method, which uses an array to get two file elements at once and upload, but it didn't work. https://www.programmersought.com/article/194562558/

2
  • See if this plugin support more id's set in option fileElementId: "file1", alternatively you can create two function like your uploadFiles and call them one after other Commented Mar 2, 2021 at 8:16
  • @TonyTomov Thank you for the comment, but if we use it like that, we are making two server calls; I am searching for a way to send in one single call. Commented Mar 3, 2021 at 7:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.