Hi all,
I am uploading images to folders and display them by using DataList.
string filename = Path.GetFileName(fileupload1.PostedFile.FileName);
string targetPath = Server.MapPath("WeddingCakeStructures/" + filename);
Stream strm = fileupload1.PostedFile.InputStream;
var targetFile = targetPath;
//Based on scalefactor image size will vary
GenerateThumbnails(0.5, strm, targetFile);
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Imge Uploaded Successfully')", true);
This is how I upload my images to a folder by using a fileuploader.I have to say that, I use here "Path.GetFileName" because if I use "Path.GetFileNameWithoutExtention" then it save without the Extention and it will not display when I host the website(Because when hosted the image should be with the extention.)
And this is how I ...
Go to the complete details ...