I have this snippet:
protected void ProcessUpload(FileUpload upload)
{
if (upload.HasFile)
{
string fileName = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName);
if (File.Exists(fileName))
File.Delete(fileName);
upload.SaveAs(fileName);
}
}
It is for ASP.NET, i want to run it in Windows Application. I get an error says FileUpload reference doesn't exist or so. FileUpload resides in System.Web.UI.WebControls which doesn't belong to Winforms family.
Please note that the file will be saved from desktop to remote file server (not ~/Uploads).
What should i do? What are the alternatives.