Thursday, August 17, 2023

Remove photo from folder

 string file_name = DropDownList1.Text;    

        string path = Server.MapPath("~/upload/");  
        FileInfo file = new FileInfo(path + file_name);
        if (file.Exists)
        {
            file.Delete();
            Label1.Text = " file deleted successfully";
            Label1.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            Label1.Text = " This file does not exists ";
            Label1.ForeColor = System.Drawing.Color.Red;
        }

No comments:

Post a Comment

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...