Posted on: 11/21/2011 12:46:57 PM | Views : 272

Hi,
 
I am using fileupload() for uploading files to a folder.
I want to be able to check if the file already exists in the upload folder and ask the user if wants to overwrite the existing file. 
How can I do this?
public void UploadExcel()
{

if (FileUpload1.HasFile)
{


try
{

string folder_from_config = ConfigurationManager.AppSettings["FileUploadFolder"].ToString();

FileUpload1.SaveAs(Server.MapPath(folder_from_config) + "\\" + System.IO.Path.GetFileName(FileUpload1.FileName));
Session["Input_Data_Excel_File"] =Server.MapPath((folder_from_config) + "\\" + System.IO.Path.GetFileName(FileUpload1.FileName));
}

catch (Exception ex)
{

...

Go to the complete details ...