JS pop-up local disk to select the folder path

Source: Internet
Author: User

When you click an event on the interface to upload files from the local disk or download the actual content to the local disk, the JS pop-up selection box is required to select the path of the local disk.

The following part of JSCodeThe logical structure of the local disk is displayed, which is used to select the folder path.

 Function Browsefolder (){
Try {
VaR Message = "Please select the folder path ."; // Selection box prompt information
VaR Shell = New Activexobject ("Shell. Application ");
VaR Folder = shell. browseforfolder (0, message, 0x0040, 0x11 );// Start Directory: My computer
// VaR folder = shell. browseforfolder (0, message, 0); // start Directory: Desktop
If (Folder! = Null ){
Folder = folder. Items (); // Returns the folderitems object.
Folder = folder. Item (); // Returns the folderitem object.
Folder = folder. path; // Return Path
If (Folder. charat (Folder. Length-1 )! = "\\"){
Folder = folder + "\\";
}
Return Folder;
}
} Catch (E ){
Alert (E. Message );
}
}

Haha. If you have any better methods, please kindly advise.

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.