I successfully manage to upload an image to my website my website and added it to a database(the name of the image) and then returned a dataset using a webmethod to display the image in a gridview. The only problem I have now(still) is to size the picture and I think it might be appropriate to use the GetThumbNailImage method.
I am however struggeling a bit.
This is my code for thw uploading of the image and I would like to know how to use this method as 开发者_如何学Cpart of this code to size the image appropriately.
if (FileUpload1.HasFile)
{
try
{
string filename = Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("~/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
KInd regards Arian
精彩评论