Friday, January 25, 2008

Uploading Images in ASP.Net 2.0

string DefaultImageName = System.IO.Path.GetExtension ( System.IO.Path.GetFileName( FileUpload_CompanyLogo.FileName));


string DefaultImagePath = Server.MapPath(".") + "/Agent_Logos/"+ Session["SellerID"] +"_Logo"+ DefaultImageName;

SaveAgentLogo(DefaultImagePath);



//Method to save the agent logo ...

private void SaveAgentLogo(string DefaultImagePath)

{

// Create and store the default image and its thumbnail.

FileUpload_CompanyLogo.PostedFile.SaveAs(DefaultImagePath);

string fileName = System.IO.Path.GetFileName(DefaultImagePath);

string strThumbnailPath = Server.MapPath(".") + @"/Agent_Logos/Thumbnails/" + fileName;

ThumbImage.C_Thumbnails(50, DefaultImagePath, strThumbnailPath);

}


-
ShriKrishna Bhardwaj , With ASP.Net, SQL Server, Javascript

No comments: