...

View Full Version : How to open a save file dialog box in javascript



tvbas
12-08-2004, 09:49 AM
:confused:

jbot
12-08-2004, 10:31 AM
you can't. you can only do it JScript. but even if it was cross-browser I wouldn't show you how ... you could be up to no good! ;)

aifilaw
12-08-2004, 05:02 PM
try this: (ie only)

<button onclick="javascript:document.execCommand('SaveAs','1','fileName.txt')">Click to save</Button>

Basscyst
12-08-2004, 05:38 PM
If you just want to have the user save a file, just make a link to the file on your server, the browser will take care of everything else. If you just want to allow the user to browse the file system. You can use:

<input type="file">

To retrieve a file path from the user.

Basscyst

PS. J-bot I understand where you are coming from, but there are plenty of resources on this stuff, all over.

jbot
12-08-2004, 09:07 PM
PS. J-bot I understand where you are coming from, but there are plenty of resources on this stuff, all over.

i know, that's why I don't see the point us adding to it ... for certain exploits anyway.

galatoms
07-15-2008, 08:36 AM
JavaScript+HTML+CSS on client side allows you initiate File Dialog!
JavaScript (together with HTML and CSS) strictly on client side (without server support) allows you initiate File Dialog and store results in the specified object as shown here:
http://www.ardentedge.com/pr_fd.htm
and
http://www.ardentedge.com/pr_WidgetBuilder_FileDialog.htm

When user gets the file name from File Dialog, s/he can do what he wants: open, upload, save appropriate file...

Philip M
07-15-2008, 09:18 AM
JavaScript+HTML+CSS on client side allows you initiate File Dialog!
JavaScript (together with HTML and CSS) strictly on client side (without server support) allows you initiate File Dialog and store results in the specified object as shown here:
http://www.ardentedge.com/pr_fd.htm
and
http://www.ardentedge.com/pr_WidgetBuilder_FileDialog.htm

When user gets the file name from File Dialog, s/he can do what he wants: open, upload, save appropriate file...

Yes, but only on the client computer!!!!
To handle a file upload to the server, a server-side process (cgi script) must be running that can handle multipart/form-data submissions.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum