Save File Dialog

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guilherme21922
    New Member
    • Jan 2008
    • 28

    Save File Dialog

    I want to on a click button save a file:

    The file is in D:\FilesExport\ Custumers.txt.

    I tried to do this but nothinh happens!

    document.execCo mmand('SaveAs', '1',"D:\\FilesE xport\\Custumer s.txt");


    if i do :

    document.execCo mmand('SaveAs', '1',"filename") ;

    the save dialog open but he save the HTML content!

    I wanto to save a file on a client.

    Thanks
  • guilherme21922
    New Member
    • Jan 2008
    • 28

    #2
    Originally posted by guilherme21922
    I want to on a click button save a file:

    The file is in D:\FilesExport\ Custumers.txt.

    I tried to do this but nothinh happens!

    document.execCo mmand('SaveAs', '1',"D:\\FilesE xport\\Custumer s.txt");


    if i do :

    document.execCo mmand('SaveAs', '1',"filename") ;

    the save dialog open but he save the HTML content!

    I wanto to save a file on a client.

    Thanks
    what i want to do is to make a file download from server

    Comment

    • pronerd
      Recognized Expert Contributor
      • Nov 2006
      • 392

      #3
      Originally posted by guilherme21922
      I want to on a click button save a file
      This is intentionally blocked in JavaScript. It would be a huge security problem if it was not. You can use ActiveX controls to save a file locally, but the user's security settings have to already be set low enough for it to work. Also that only works in IE.


      Originally posted by guilherme21922
      what i want to do is to make a file download from server
      JavaScript is a client side language. Meaning it executes on the client, not the server. It has no ability to make something happen on the server.

      If you just want the user to download a file then all you need to do is send a request to the server with the URL that file will be returned from. You have very little control over what the user's PC does with the file. It may save it, or automatically open it in what ever application works with that file type.

      You can force the save file dialog box by setting the MIME type in the response to be a faked value like "applicatio n/unknown", but you can not control where it is saved.

      Comment

      Working...