Safari 11: submission not works when input[type=file] is not empty

279 views Asked by At

Since the Safari 11 update on macOS High Sierra and Mojave, the submit in my web application are failing when a input[type=file] field has file chosen (it is required in my form).

After pressing the submit button and waiting for a while, safari-resource: /ErrorPage.html is displayed.

I am HTTPS and submitting to a location on the same domain (and server) also over HTTPS. In our testing environment we are connecting over HTTP (not HTTPS), but in this case it works perfectly.

Before the 11 update, the submit just fine when file was chosen. We have confirmed that the same issues occur in Safari 12. The latest versions of Chrome and IE have no issues(i.e. can upload).

Relevant parts of my code:

The html:

<form id="upload" name="upload" method="POST" enctype="multipart/form-data" th:action="@{/hoge/fuga}">
    <input type="file" id="uplfile" name="uploadFile" accept=".pdf" />
    <button id="upl_btn" type="button">upload</button>
</form>

The JS:

$("#upl_btn").on('click', function() {
    if (!IsSuccessPreCheck()) { // Checking file format etc...
        return false;
    }
    document.upload.submit(); // In the Web Inspector, I can confirm that I can go this far.
});

Am I doing something wrong, is there an issue with Safari?

Thank you in advance for your cooperation.

0

There are 0 answers