Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: execCommand("saveAs")


Message #1 by aoadeyemo@h... on Mon, 10 Dec 2001 14:38:08
--0-2065249113-1008151790=:14113
Content-Type: text/plain; charset=us-ascii


 You can use the Scripting.FileSystemObject object and you can create your own (text) files. Warning: this method is unsafe for
scripting, so the browser (IE) will generate a warning dialog. 
In fact, you want to use the Save Common Dialog Box (isn't it?). This is a COM object and the client should have it on the machine. 
You can try use input type="file" (I think it's the best solution).
  aoadeyemo@h... wrote: Hi all,
I was just wondering if it's possible to use the execCommand("SaveAs") to 
Save a text file already on the client or server as opposed to saving a 
web page.
The scenario:
My users' are exporting data, i've written an object in ASP to create a 
temp file in c:\winnt\temp.. if export is successful. Once the temp file 
is created i'll like the users to save the file to their own preferred 
path through the saveAs dialog box, then obviously delete the temp file.
I've managed to do this without the dialog as in forcing the users to 
write out the full path, but it dosen't seem user friendly.
Any idea(s) will be highly welcome.

NB: i've started playing round this saveas command but when i save the 
file the result is an internet message: page cannot be found.

code:

function getFile(file)
{
  window.WINNT_TEMP = window.open(file,"Get","width=50,height=50");
  setTimeout
('WINNT_TEMP.document.execCommand"SaveAs");WINNT_TEMP.close);', 1000);
}



Cheers
Ade'



---------------------------------
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctionsfor all of your holiday gifts!

  Return to Index