Is there a File Transfer Component

J

Jon Turner

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
 
D

dwa

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;
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top