Multiple document selection in Cases EditView

In Cases module -> editView, there is an option to update attachments. Here we can upload 1 file at once. I wanted to modify it so that users can select multiple files at once.

I changed the form in modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl
(For External Files) Input field -> case_update_file[] -> added attribute multiple

        <input type="file" id="case_update_file[]" name="case_update_file[]" multiple>

(For Internal Document Files) Button -> btn_case_document_name -> onclick -> open_popup -> changed parameter single to multiple.

        open_popup(
                                "Documents",
                                600,
                                400,
                                "",
                                true,
                                false,
                                {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"case_document_id","name":"case_document_name"}},
                                "multiselect",  // was single before 
                                true
                                );

External files seem to work fine. But internal document selection isn’t working.
When I select multiple files (through checkboxes) in the popup and click the select button, it doesn’t return anything. Whereas it works when I select a single file (clicked a single name, not through checkbox)

Also, how do I make it upgrade-safe?

Thanks in advance.