Reading File using JS

Discussion in 'JavaScript' started by Arunv, Oct 4, 2009.

  1. #1
    How can we Read and write a file using Javascript.....!! Which we can use in the Ajax without refreshing the page...
     
    Arunv, Oct 4, 2009 IP
  2. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Where would that file be located?
     
    caprichoso, Oct 5, 2009 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    You can use javascript to READ a file that is located only on YOUR server (using AJAX). But the only way that you can use javascript to WRITE a file is to use AJAX (or even IFRAME or IMG tags) to send data to a server-side script (php,asp etc...) that will write the data that is sent for you.
     
    camjohnson95, Oct 6, 2009 IP
  4. Jj delc

    Jj delc Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can NOT read a file on the client's computer(the computer where the browser is running).

    As mentioned here you can read files on other places on the internet, on your own server via regular ajax or in other domains using some tricks.
     
    Jj delc, Oct 6, 2009 IP
  5. lawracri

    lawracri Peon

    Messages:
    74
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    JavaScript can't do this, but it can be done with JScript (ActiveX)
     
    lawracri, Oct 6, 2009 IP