W ) 1 ) DataRemove In Folder offline , 2 ) Upload Image Video in Folder On Live Server And Data remove in folder
* DataRemove *
Q ) How to remove image inside the folder
{
// How to remove image inside the folder
string filename = DropDownList1.Text;
string path = Server.MapPath("~/img/");
FileInfo f1 = new FileInfo(path + filename); // library Using System.Io;
if (f1.Exists)
{
f1.Delete();
Response.Write("file deleted succesfully");
}
else
{
Response.Write("file not found");
}
}
* Assigment :- Remove Data in Gridview (Image
Upload,Insert , Update , Delete(doc+img) )*
* DataRemove on Server And Add Data on server (pic) *
Q ) How to add Image Video in folder on server
Step 1 :- Create Folder (UploadandDelete) -- folder ke ander second folder (pic) --
Step 2 :- Create webpage -- Tools (1 -FileUploader , 2-button (upload) , Image , Label
Step 3 :- Code :-
protected void Button1_Click(object sender, EventArgs e)
{
FileUpload1.SaveAs(Server.MapPath(@"~/UploadAndDelete/") + "//pic//" + FileUpload1.FileName);
// foldername (UploadAndDelete)
Image1.ImageUrl = "~/UploadAndDelete/pic/" + FileUpload1.FileName;
// ~ tield symbol age kuch bhi ho data image find kr leta hai
// UploadAndDelete ke ander pic folder hai smjne ke liye
Label1.Text = FileUpload1.FileName;
}
step 4:- server pe upload kro folder pic submit krne par error dega , tab Web.confige
<customErrors mode="Off"></customErrors> mode ="off" off kr dene par error solve ho jayega aur config file ko delete krke firse usi folder mein upload krna hai .
Q ) How to increase upload time. (Video ,Image)
This tag use before < Comiplation Tag >
: - < httpRuntime executionTimeout="350" maxRequestLength="5000" />
Q ) How to Remove Data in folder on Server ( IMAGE ,Video) .
protected void Button2_Click(object sender, EventArgs e)
{
string filename = Label1.Text; // delete code on server
string path1 = Server.MapPath(@"~/UploadAndDelete/pic/");
FileInfo f1 = new FileInfo(path1 + filename);
if (f1.Exists)
{
f1.Delete();
Response.Write("file deleted succesfully");
}
else
{
Response.Write("file not found");
}
}
* Server upload and delete concept video Confige file show mising this video confige file in Scresshot *
Comments
Post a Comment