By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

File I/O Operation

dmjpro
100+
P: 2,476
Could I get any good link of File I/O operation for cross browser?
Please help!
Jul 24 '08 #1
Share this Question
Share on Google+
16 Replies


gits
Expert Mod 5K+
P: 5,343
could you give a short example or use case for what you want to do ... just to understand your requirement corrcetly?

kind regards
Jul 24 '08 #2

rnd me
Expert 100+
P: 427
Expand|Select|Wrap|Line Numbers
  1. function IO(U, V) {
  2. //LA MOD String Version. A tiny ajax library.  by, DanDavis
  3.     var X = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
  4.     X.open(V ? 'PUT' : 'GET', U, !1);
  5.     X.setRequestHeader('Content-Type', 'text/html')
  6.     X.send(V ? V : '');
  7. return X.responseText;}
see usage notes here
Jul 24 '08 #3

dmjpro
100+
P: 2,476
could you give a short example or use case for what you want to do ... just to understand your requirement corrcetly?

kind regards
Basically i need to create,update,delete,read a file on the local file system when my web page loads into browser.
Jul 25 '08 #4

rnd me
Expert 100+
P: 427
you hill have to use another language than javascript unless the page is run from the same drive/folder as the files you want to manage.
Jul 25 '08 #5

dmjpro
100+
P: 2,476
you hill have to use another language than javascript unless the page is run from the same drive/folder as the files you want to manage.

Can't I specify the absolute directory?
Jul 25 '08 #6

gits
Expert Mod 5K+
P: 5,343
no ... that is not possible either ... you could use a filepicker control to let the user upload/choose a file and the user should download a file and he could decide where to save it ... you might ask the user for the location and save that with his user-id and then retrieve it from a database before building up the page serverside ... for a kind of workaround for your problem :)

kind regards
Jul 25 '08 #7

rnd me
Expert 100+
P: 427
is IE only compatibility ok with you?
Jul 25 '08 #8

gits
Expert Mod 5K+
P: 5,343
not with me ;) ... (but i think i know what you want to suggest) ...

kind regards
Jul 25 '08 #9

dmjpro
100+
P: 2,476
is IE only compatibility ok with you?
But i saw a IO library in Mozilla ...
Though I didn't test it ... Just i wanted to know from experts that whether it is possible to do cross browser file I/O operations in JavaScript?

Anyway thanks for all responses .. :-)
Jul 25 '08 #10

gits
Expert Mod 5K+
P: 5,343
nope ... there is no cross-browser way that i'm aware of ... only browser-specific ways ... or workarounds with serverturnarounds ...

kind regards
Jul 25 '08 #11

dmjpro
100+
P: 2,476
nope ... there is no cross-browser way that i'm aware of ... only browser-specific ways ... or workarounds with serverturnarounds ...

kind regards
Sorry Gits ... I was not looking for common JS function ....
Anyway i will try out for both IE and as well as in Mozilla ..... I think for these browsers i have to specific code.

Thanks Gits ..!
Jul 25 '08 #12

gits
Expert Mod 5K+
P: 5,343
i assume for IE there is some ActiveX-control combined with some security-settings available and in MOZ/FF you would need to set specific privileges to the script ... what makes it hard for use in a public page ... but i guess you need it for an internal application?

kind regards
Jul 25 '08 #13

dmjpro
100+
P: 2,476
i assume for IE there is some ActiveX-control combined with some security-settings available and in MOZ/FF you would need to set specific privileges to the script ... what makes it hard for use in a public page ... but i guess you need it for an internal application?

kind regards
What do you mean by internal Application?
Here i am using Java so should i use here Applet? :-)
Jul 25 '08 #14

gits
Expert Mod 5K+
P: 5,343
with internal application i mean an intranet or local app ... but not a public webpage

what to use depends on the usecase ... i think i wouldn't use a java-applet just for the purpose of reading/writing a file but of course it is an option ... a webpage basicly shouldn't need to work with local files, and more important ... when it needs it ... the user must! have control over it and it shouldn't be 'silent' ... because this could be considered as a kind of intrusion ... even when that is not the intention of the application ...

kind regards
Jul 25 '08 #15

rnd me
Expert 100+
P: 427
if your already in java, use its file classes, no need for javascript.

in javascript, you can load pages locally if the user "saves as" into the parent folder, and runs the page from there. this would be fairly cross-browser compatible, relying on ajax. you would only need to unify the path for IE/FF diffs.
Jul 26 '08 #16

dmjpro
100+
P: 2,476
if your already in java, use its file classes, no need for javascript.

in javascript, you can load pages locally if the user "saves as" into the parent folder, and runs the page from there. this would be fairly cross-browser compatible, relying on ajax. you would only need to unify the path for IE/FF diffs.
See ..... I want the File I/O on client side ....... :-)
Jul 27 '08 #17

Post your reply

Sign in to post your reply or Sign up for a free account.