Skip to content

[upload] IE11 uploading multipart form data need to be in a specific order #1222

Open
@sey

Description

@sey

Hi,

When uploading a file on IE11 (not yet tested on other IE or edge versions) the different parts of the upload need to be in a specific order.
Meaning if you upload a file and add some other information like an ID, the file need to be last in the form data. Nothing is sent after the file.
This looks very much like the known issue of pristine checkboxes being last in a form which are not sent with IE.

I posted the issue on stackoverflow recently.

The quickfix for this is to allow appending data to the FormData object before the file is added to the FormData. Passing the formData object to the upload-before event did the trick for me.

const evt = this.dispatchEvent(
    new CustomEvent('upload-before', {
        detail: {file, xhr, formData},
        cancelable: true
    })
);

Before submitting a pull request, I'd like to know if that fix is ok with you. Or if there are specific reasons why the formData was not passed originally for that event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions