/    Sign up×
Community /Pin to ProfileBookmark

Help! Question about how to popup Windows file browser from Javascript

Hello!
I’m working on a project which requires when user clicked submit button on a form, I need to popup a Windows file browser to let them select where to open/save their file. I really have no clue how to do it, can anyone help? Thank you!
I know there is something like:
<input type=”file” name=”file” value=”file”/>
But I can’t use this. I don’t like the widget on my page, I want when use submit a form, I will start file browser window in my javascript code.
Thank you very much.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@cgishackMay 31.2008 — Here is a hacked up way you can route the input type=file click from another button and hide the file form

I only seems to work in IE.

Maybe there is a better way... I dont know



<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Open File Dialog in IE&lt;/title&gt;

&lt;script&gt;

function openFileBrowser()
{
//route the click form event
var fileBrowser = document.getElementById('myFileBrowser');
[B]fileBrowser.click();[/B]
}
&lt;/script&gt;
&lt;/head&gt;


&lt;body&gt;


&lt;input type="file" name="myFileBrowser" id="myFileBrowser" [B]style="display:none;"[/B]/&gt;
&lt;input type="submit" name="button" id="button" value="Open Dialog" [B]onclick="openFileBrowser()"[/B]/&gt;


&lt;/body&gt;
&lt;/html&gt;



Drew
Copy linkTweet thisAlerts:
@enzhuauthorJun 01.2008 — Hi Drew, it works great, thanks a lot!!!
Copy linkTweet thisAlerts:
@cgishackJun 01.2008 — remember, its IE only
×

Success!

Help @enzhu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...