Welcome to WebmasterWorld Guest from 54.156.67.122

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

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

New User

10+ Year Member

joined:Aug 2, 2007
posts: 24
votes: 0


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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 29, 2007
posts:1147
votes: 0


There is absolutely no way you can access the local filesystem. Your best bet is to write some activeX or something.
4:02 am on Nov 24, 2007 (gmt 0)

New User

10+ Year Member

joined:Aug 2, 2007
posts: 24
votes: 0


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
5:37 pm on Nov 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 29, 2007
posts:1147
votes: 0


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.
3:36 am on Nov 26, 2007 (gmt 0)

New User

10+ Year Member

joined:Aug 2, 2007
posts: 24
votes: 0


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?
5:53 pm on Nov 26, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 29, 2007
posts:1147
votes: 0


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

Full Member

10+ Year Member

joined:Feb 12, 2006
posts:224
votes: 0


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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members