Load contents of a text file into a text box

Discussion in 'ASP .Net' started by Jeremy Chapman, Aug 15, 2003.

  1. How can I display a file open dialog by clicking a button in an aspx page,
    have the user select a text file then display the contents into a control
    such as a text box
     
    Jeremy Chapman, Aug 15, 2003
    #1
    1. Advertising

  2. Jeremy Chapman

    Tommy Guest

    I don't know if you could open a file using client-side script. This
    don't sound right from a security point of view. However, you can have
    the user upload the file to your webform. Your webform then opens the
    file on the server, reads its contents, and populate it to the textbox
    and return to the client.

    The following is some sample HTML code that will show a open file
    dialog box on the client-side and allow the user to upload a file.

    ********************************************
    <html>
    <body>
    <form name="form1" action="form1" enctype="multipart/form-data"
    method="post">
    <p>
    Type some text (if you like):<br>
    <input type="text" name="textline" size="30">
    </p>
    <p>
    Please specify a file, or a set of files:<br>
    <input type="file" name="datafile">
    </p>
    <p>
    <input type="submit" value="Send">
    </p>
    </form>
    </body>
    </html>
    ********************************************

    Tommy,

    "Jeremy Chapman" <> wrote in message news:<>...
    > How can I display a file open dialog by clicking a button in an aspx page,
    > have the user select a text file then display the contents into a control
    > such as a text box
     
    Tommy, Aug 15, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gnarlodious
    Replies:
    4
    Views:
    17,717
    elizas
    May 5, 2010
  2. Foxy Kav
    Replies:
    6
    Views:
    7,823
    tom_usenet
    Apr 28, 2004
  3. Dave
    Replies:
    4
    Views:
    564
    Siemel Naran
    May 21, 2004
  4. basi
    Replies:
    15
    Views:
    319
    Ryan Leavengood
    Dec 7, 2005
  5. Kamarulnizam Rahim
    Replies:
    4
    Views:
    252
    Robert Klemme
    Jan 28, 2011
Loading...

Share This Page