The problem of jquery.form.js denying access in IE and the input upload button must be actively clicked

The problem of jquery.form.js denying access in IE and the input upload button must be actively clicked

Let's take a look at the code first

<form id="uploadFileForm2" name="uploadFileForm2" enctype="multipart/form-data" method="post">
    <div class="upload-wapper mt20">
        <input type="file" name="excelfile" id="dataFile" class="dataFile" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
        <a href="javascript:;" id="uploadFile" class="upload-file">Upload file</a>
        <div id="J_progress_label"></div>
    </div>
</form>

// Save import $("#uploadFile").click(function(){
    $("#dataFile").click()
})

When uploading using jquery.form.js in IE, access is suddenly denied. The simulated click event of jq is used. I found that in IE, unless you click the browse button of the file control, you do not have permission to upload the file. Then you need to submit it in the form of a form, and the enctype attribute must be included. In other words, you cannot use js to control the value of the file control to upload files.

If you think the file is ugly, you can use the CSS style to hide the file, then set the button to transparent and cover it. You can also use a div to wrap the <input type=”file”> tag to solve the problem. At the same time, pay attention to setting the CSS style. Note that the button position of the <input type=”file”> tag is different in Google and IE8.

Summarize

This is the end of this article about the jquery.form.js access denied issue in IE, and the input upload button must be clicked actively. For more information about IE jquery.form.js access denied issue, please search 123WORDPRESS.COM's previous articles or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  The difference between html form submission action and url jump to actiond

>>:  Detailed explanation of application scenarios of filters in Vue

Recommend

How to change the CentOS server time to Beijing time

1. I purchased a VPS and CentOS system, and found...

Vue two-choice tab bar switching new approach

Problem Description When we are working on a proj...

Detailed tutorial on Docker pulling Oracle 11g image configuration

Without further ado Start recording docker pullin...

Non-standard implementation code for MySQL UPDATE statement

Today I will introduce to you a difference betwee...

UDP simple server client code example

I won’t go into details about the theory of UDP. ...

Docker uses root to enter the container

First run the docker container Run the command as...

Common HTML tag writing errors

We better start paying attention, because HTML Po...

Linux gzip command compression file implementation principle and code examples

gzip is a command often used in Linux systems to ...

Vue implements Modal component based on Teleport

Table of contents 1. Get to know Teleport 2. Basi...

TypeScript learning notes: type narrowing

Table of contents Preface Type Inference Truth va...

15 Vim quick reference tables to help you increase your efficiency by N times

I started using Linux for development and enterta...