String fileName = FileUpload1.FileName; int newlrmnsdf = fileName.Length; int gdf = newlrmnsdf - 4; string strwithoutEXT = fileName.Substring(0,gdf); string currenttime = System.DateTime.Now.Minute.ToString() + "_"; string newFileName = strwithoutEXT + currenttime + ".jpg"; string actualFilename = currenttime + newFileName; bool IsExists = System.IO.Directory.Exists(Server.MapPath("temp")); if (!IsExists) { System.IO.Directory.CreateDirectory(Server.MapPath("temp")); FileUpload1.SaveAs(Server.MapPath("~/temp/") + actualFilename); } else { FileUpload1.SaveAs(Server.MapPath("~/temp/") + actualFilename); } if (fileName.Contains(".pdf")) { //Image1.Visible = false; // frame1.Attributes.Add("src", "http://localhost:50389/temp/" + actualFilename); } else { // frame1.Visible = false; // string url = "http://localhost:50389/temp/" + actualFilename; string path = Server.MapPath("~/temp/"); Image1.ImageUrl = path + actualFilename; }
"~/temp/"+actualFilename
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)