Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: A serious suprise ! (to me at least)

  1. #1
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation A serious suprise ! (to me at least)

    Hello ,

    I was just searching through the web today and found how you can opne and read files (but have not tried to find write and erase...yet) - here is the script -

    <html>
    <body>
    <script type="text/javascript">
    <!--//

    //-----------------------------------------------------------------------
    // author: Vincent Puglia
    // site: http://members.aol.com/grassblad
    //-----------------------------------------------------------------------

    function loadFile(oSrc, oDest)
    {
    var fso, oFile, contents
    var ForReading = 1
    var txtFile = oSrc.value;
    fso = new ActiveXObject("Scripting.FileSystemObject")
    oFile = fso.OpenTextFile(txtFile, ForReading)
    contents = oFile.ReadAll()

    oDest.value = contents;
    oFile.Close()
    }

    //-->
    </script>
    </head>
    <body>
    <form name="a">
    <input type="file" name="b">
    <input type="button" value="Load It" onclick='loadFile(this.form.b, this.form.c)'>
    <br>
    <textarea name="c" cols="80" rows="25"></textarea>

    </form>
    </body>
    </html>

    Can anyone give me a tutorial on this or a site ?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    ActiveX is IE only, so that's no fun.

    I don't know much more about this, though, sorry.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks though, i forgot it was only ie ...

    But oh well...

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    You cant write or erase files client side.
    And this looks like ajax...
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by boxxertrumps View Post
    You cant write or erase files client side.
    Correct you are. Unless you use some server side language with an AJAX invocation.

    And this looks like ajax...
    Nope, just ActiveX control for IE.
    Last edited by thetestingsite; 03-17-2007 at 01:45 AM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Note "ActiveXObject" in the code
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yes, it would be much more effecient to do so server-side.
    - Mike

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    But you could still read files with ajax.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Server-side is not neccessary. You could just make a request direct to the text file.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Those last two posts confuse me.

    AJAX would require server side code in the page that is retrieved via ajax.

    And, you can't read a text file on the user's computer without ActiveX, or Java. (Or flash, in some cases, and of course cookies, but those are limited).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •