Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Problem with Save As Dialog using Javascript
Old 05-08-2009, 08:52 AM Problem with Save As Dialog using Javascript
Junior Talker

Posts: 2
Name: Sachin
Trades: 0
Hello,

I am facing a Big problem with SaveAs Dialog box created using JavaScript.
My requirement is to allow user to enter the File Name in SAve As Dialog Box in which he/she can save the Data.
I am using "document.execCommand('SaveAs','false','ProfileNameToSave.xml');" to do this.
But how can I get the path of File Name from execCommand, entered by user into a variable which can be used further to write the Data.
Also I am able to see only the File types as HTML and txt in Dialog.

No help is available on web on this topic. I am stuck badly with this issue.

Thanks is advance.
Regards,
Sachin
sachinma is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-08-2009, 09:01 AM Re: Problem with Save As Dialog using Javascript
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
There is no help available on the web, because you can't do it. JavaScript has no access to the file system on your computer, nor should it. It wouldn't be right to allow random websites unfettered access onto any personal computer.

If what you're looking for is the ability to save files on a server (it isn't clear from your question), you need to look into doing this with a server-side programming language. JavaScript also cannot do this.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-08-2009, 11:38 AM Re: Problem with Save As Dialog using Javascript
Junior Talker

Posts: 2
Name: Sachin
Trades: 0
Thanks for your reply which made good insight into strategy behind such design for a newbee like me !

But I have my stand-alone Static HTML page which takes different inputs (e.g. Employee Name, Age, Address etc.) and saves into a XML file. For this I have few controls like text areas, selection boxes etc. and User press a Save button which allows user to enter the file name and location.
So I wish to save such file on harddisk.

So if JavaScript is not the way, so will you please suggest what can be a good way to do this.

Regards,
Sachin
sachinma is offline
Reply With Quote
View Public Profile
 
Old 05-08-2009, 12:51 PM Re: Problem with Save As Dialog using Javascript
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
JavaScript can't save anything to files, so that is out of the question.

What you are describing is basically impossible from inside of a webpage, though there may be some ways to do it on an intranet with browser security settings very low, I'm not sure. On a public internet site, it is not going to happen. Period.

The only alternative I can think of, is save the XML file to the server, then allow it to be downloaded by the user so that it may be placed on his or her computer wherever they please. It would not be retrievable after you did that, but you could always retrieve it from the server if you needed it. A better option would honestly be to use a database, though I'm not sure of your intent here.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Problem with Save As Dialog using Javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19805 seconds with 12 queries