Is there a File Transfer Component

Discussion in 'ASP .Net Web Controls' started by Jon Turner, Jan 26, 2004.

  1. Jon Turner

    Jon Turner Guest

    Is there a File Transfer component in .NET or an ActiveX that
    will allow you to select a file to transfer from the client to the
    server. A Freeby would be the most preferred.

    Many thanks
    Jon Turner, Jan 26, 2004
    #1
    1. Advertising

  2. Jon Turner

    Tom Kiefer Guest

    Tom Kiefer, Jan 26, 2004
    #2
    1. Advertising

  3. Jon Turner

    dwa Guest

    The .NET framework supports it. You can use a standard HTML button with a
    type of "file":

    <INPUT type="file" id="buttonImage" runat="server" size="40">

    When the user submits (posts the form back), you can process the file
    transfer in a fashion similar to this (error checking left out for clarity):

    public string postFile(HtmlInputFile theFile /* this is the server side
    INPUT control */ )
    {
    string theFinalPath = "";

    // Get the base file name of the posted file...
    String aPostedFileName =
    System.IO.Path.GetFileName(theFile.PostedFile.FileName);

    // Get the physical path name for this application's virtual
    directory...
    String aPath = this.Server.MapPath(".\\");

    // Save the file...
    theFinalPath = aPath + "UploadedFiles\\" + aPostedFileName;
    theFile.PostedFile.SaveAs(theFinalPath);

    return theFinalPath;
    }
    dwa, Jan 27, 2004
    #3
    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. Soni
    Replies:
    0
    Views:
    1,080
  2. Martin

    Server.Transfer in Component

    Martin, Feb 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    321
    John Timney \(Microsoft MVP\)
    Feb 2, 2004
  3. jiing
    Replies:
    5
    Views:
    373
    Mark McIntyre
    Apr 13, 2005
  4. Jim
    Replies:
    1
    Views:
    877
    Aaron Bertrand - MVP
    Jan 28, 2004
  5. Miguel Minora
    Replies:
    1
    Views:
    149
    Miguel Minora
    Jan 11, 2005
Loading...

Share This Page