0

I have a web page containing a textbox. This textbox shows result of processing. There is a button "Save Result" to save contents of textbox to file. I know it can be easily done with FileStream. But I want the same functionality to save file using Javascript so that there is no need for server postback.

Do anybody have solution to this?

Thanks for sharing your time.

demongolem
  • 9,474
  • 36
  • 90
  • 105
IrfanRaza
  • 3,030
  • 17
  • 64
  • 89
  • 1
    possible duplicate of [Save File From Local Data in Javascript](http://stackoverflow.com/questions/2762236/save-file-from-local-data-in-javascript) – Quentin May 07 '11 at 07:09
  • 1
    Where do you want to save this file to? Server or client? If it is the client, no need to waste your time as you cannot write to the client filesystem using javascript. – Darin Dimitrov May 07 '11 at 07:17
  • @David: I used Downloadify and its working. Thanks – IrfanRaza May 07 '11 at 07:39

2 Answers2

1

As Darin said JavaScript works on the client's side. As far as I know you won't be able to create files on the user computer using javascript.

A little google-ing mentioned it being posible with JScript/ActiveX/IE (Never tried it).But I would suggest a different approach. Good luck!

Fernando
  • 68
  • 1
  • 6
1

You can save it to the client's file system using html5's local storage, however it will only be available to that website.

Variant
  • 17,279
  • 4
  • 40
  • 65