0

How to write image raw content response from php to file with Javascript?

Actually I am using JSZip to compress some files in chrome extension. I am accessing the files with a rest call which gives response as file raw content(response as php file_get_content())

Harish Ambady
  • 12,525
  • 4
  • 29
  • 54
  • you can't, or at least not directly, but there are ways around this; see: http://stackoverflow.com/questions/585234/how-to-read-and-write-into-file-using-javascript – user428517 Aug 06 '13 at 12:48

1 Answers1

1

No you can't!

javaScript himself can't for security reasons...

  • You can use Ajax to send requests to a php function that will return you the file content or
  • You can use TiddlySaver jquery plug in which uses an applet (Note that the TiddlySaver applet is required on Opera and WebKit-based browsers (Safari, Chrome). The applet has to be present in the same folder as the respective HTML document. )
Bellash
  • 7,560
  • 6
  • 53
  • 86