Forum Moderators: open

Message Too Old, No Replies

Javascript/Ajax and read/write binary (base64) files

Write binary data returned from XMLHttpRequest to a file

         

coolclu3

5:02 am on Nov 22, 2007 (gmt 0)

10+ Year Member



Hi all
I have a scenario as follows:

1. Client Send request via Ajax
2. Returned data is a .swf file stream , encoded in base64
3. I want to write this data into a local .swf file, so that i can display it in browser

I have tried to write the data directly into browser, using probably data URL scheme, WITHOUT success,

I want it to work on IE & Firefox, if possible

Please help me out guys, I'd really appreciate it

Dabrowski

3:37 pm on Nov 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is absolutely no way you can access the local filesystem. Your best bet is to write some activeX or something.

coolclu3

4:02 am on Nov 24, 2007 (gmt 0)

10+ Year Member



I read some where that adodb.stream is able to write to local files, but only with limited versions of IE ( versions < 5.x)....This issue seems hopeless

Dabrowski

5:37 pm on Nov 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In older browser versions you used to be able to access the history list, and change the status bar text too, but all this has been taken away becuase some idiot choose to abuse these features. You now cannot do anything outside the browers's viewing area.

coolclu3

3:36 am on Nov 26, 2007 (gmt 0)

10+ Year Member



I want to use this javascript on a local HTML file. Is there a way for browsers to know that the file is on localdomain, and thus allow more authority for javascript, to access local files, somehow?

Dabrowski

5:53 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope

mehh

4:11 pm on Nov 29, 2007 (gmt 0)

10+ Year Member



If you really need this to work you could always use a PHP (or other serverside language) proxy script so ajax sends info php gets the file and writes it to a specified location, the ajax then creates a dynamic object and embeds it in to the HTML the browser downloads this swf then the php deleates it. this is HUGE overkill though and don't recomend it.
You may want to look into directly embedding it into the HTML document aswell. For example if your dealing with a png file:
<img src="data:image/png;base64,*your data here*">
But I have no idea if you can do a simmilar thing with .swf files.