ldlchina ldlchina - 1 year ago 136
Javascript Question

How to open a file browser with default directory in Javascript?

I want to open a file browser in JavaScript and set a default directory to this file browser.
For example, I will like to set the default directory to "C:\My Documents".

How to set a default directory?
It's better to use

<input type="file"/>
, other controls are ok too.

Answer Source

This is impossible, as it is a security risk to let website code set any value on the machine.

Also, you can never be sure that directory exists. What if I'm on a Mac? My stuff are in ~/Pictures. What if I installed Windows on D:\?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download