似乎我需要得到" g"在附件中代替fileUpload1.PostedFile。我似乎无法弄明白。任何帮助表示赞赏。我尝试使用g.save(@" c:\ Temp \ test.jpg"),但它不会保存:(
var bmp = new Bitmap(FileUpload1.PostedFile.InputStream);
var newImage = new Bitmap(200,200);
var g = Graphics.FromImage(newImage);
g.DrawImage(bmp, 0, 0, 200, 200);
string fileName =
Path.GetFileName(FileUpload1.PostedFile.FileName);
Attachment myAttachment = new
Attachment(FileUpload1.FileContent, fileName);
mail.Attachments.Add(myAttachment);