May 1, 2011

Upload File on server using File Upload Control in ASP.Net

Here i will try only excel file to upload on server

if (fileUpl.HasFile) //fileUpl is file upload control
{
            fileExt = System.IO.Path.GetExtension(fileUpl.FileName);
}

if ( fileExt == ".xls" )
{
      fileUpl.SaveAs(Server.MapPath(".\\UploadFile\\" + fileUpl.FileName)); // will upload file on server in folder UploadFile
      fileUpload = true;
}

No comments:

Post a Comment