IE8 obtaining the local file path when uploading files (C: \ fakepath \......) Solution

Source: Internet
Author: User

Let's take a look at the JSP code:

Bytes ---------------------------------------------------------------------------------------------------------------

<Tr>

<TD align = "right"> attachment upload: </TD>
<TD> <input type = "file" name = "myfile" id = "myfile" label = "select file"/> </TD>

</Tr>

Bytes -----------------------------------------------------------------------------------------------------------------

VaR myfile = $ ("# myfile"). Val ();

Alert (myfile );

No matter how the file is selected, the output result is: C: \ fakepath \......

Bytes -----------------------------------------------------------------------------------------------------------------

When I used IE8, I did not expect that the function of previewing local images with Javascript in the upload of images on a website is invalid. The image is always displayed incorrectly and alert () is used () after reading the film, the path becomes c: \ fakepath \*. JPG. The actual path is replaced by c: \ fakepath. After research, it turns out that IE8 has added security options. By default, the real path of the uploaded file is not displayed. Go to the Internet option and modify the settings to display the real file path.

The procedure is as follows:

Tools-> Internet Options-> Security-> Custom Level-> Find "include local directory path when uploading local files to the server" in "others", and select "enable,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.