File I/O Operation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    File I/O Operation

    Could I get any good link of File I/O operation for cross browser?
    Please help!
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    could you give a short example or use case for what you want to do ... just to understand your requirement corrcetly?

    kind regards

    Comment

    • rnd me
      Recognized Expert Contributor
      • Jun 2007
      • 427

      #3
      Code:
      function IO(U, V) {
      //LA MOD String Version. A tiny ajax library.  by, DanDavis
          var X = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
          X.open(V ? 'PUT' : 'GET', U, !1);
          X.setRequestHeader('Content-Type', 'text/html')
          X.send(V ? V : '');
      return X.responseText;}
      see usage notes here

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by gits
        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,d elete,read a file on the local file system when my web page loads into browser.

        Comment

        • rnd me
          Recognized Expert Contributor
          • Jun 2007
          • 427

          #5
          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.

          Comment

          • dmjpro
            Top Contributor
            • Jan 2007
            • 2476

            #6
            Originally posted by rnd me
            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?

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5390

              #7
              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

              Comment

              • rnd me
                Recognized Expert Contributor
                • Jun 2007
                • 427

                #8
                is IE only compatibility ok with you?

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #9
                  not with me ;) ... (but i think i know what you want to suggest) ...

                  kind regards

                  Comment

                  • dmjpro
                    Top Contributor
                    • Jan 2007
                    • 2476

                    #10
                    Originally posted by rnd me
                    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 .. :-)

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5390

                      #11
                      nope ... there is no cross-browser way that i'm aware of ... only browser-specific ways ... or workarounds with serverturnaroun ds ...

                      kind regards

                      Comment

                      • dmjpro
                        Top Contributor
                        • Jan 2007
                        • 2476

                        #12
                        Originally posted by gits
                        nope ... there is no cross-browser way that i'm aware of ... only browser-specific ways ... or workarounds with serverturnaroun ds ...

                        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 ..!

                        Comment

                        • gits
                          Recognized Expert Moderator Expert
                          • May 2007
                          • 5390

                          #13
                          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

                          Comment

                          • dmjpro
                            Top Contributor
                            • Jan 2007
                            • 2476

                            #14
                            Originally posted by gits
                            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? :-)

                            Comment

                            • gits
                              Recognized Expert Moderator Expert
                              • May 2007
                              • 5390

                              #15
                              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

                              Comment

                              Working...