Methods for obtaining the full path of input file for IE 6, 7, 8, and Firefox

Source: Internet
Author: User

Here's a way to get input file full path compatible with IE 6, 7, 8, and Firefox, which does not support Chrome and Safire, and to support these browsers may have to use Flash, which is cumbersome for programmers, and also wants someone to write and share , the following are compatible with IE and FF code:

/*
* Web effects get the full path of the picture
*/

function GetFullPath (obj) {
if (obj) {
Internet Explorer
if (Window.navigator.userAgent.indexOf ("MSIE") >= 1) {
Obj.select ();
Return Document.selection.createRange (). text;
}
Firefox
else if (window.navigator.userAgent.indexOf ("Firefox") >= 1) {
if (obj.files) {
Return Obj.files.item (0). Getasdataurl ();
}
return obj.value;
}
return obj.value;
}
}

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.