2009-10-02 53 views

回答

0

看到這個article

例如:

Response.ContentType = "image/jpeg";

Response.AppendHeader( 「內容處置」, 「附接; 文件名= SailBig.jpg」);

Response.TransmitFile( Server.MapPath(「〜/ images/sailbig.jpg」) );

Response.End();

這將導致打開/另存爲 對話框彈出與SailBig.jpg的文件名 作爲默認文件名 預設。

這當然假設你給 一個已存在的文件。如果喂動態生成你 需要 - 說在 存儲器生成的圖像 - 可以使用 Response.BinaryWrite()後流式 字節數組或直接在Response.OutputStream輸出寫入 。

Bitmap bmp = wwWebUtils.CornerImage(backcolor, color,c,Radius,Height,Width);

Response.ContentType =「image/jpeg」;

Response.AppendHeader(「Content-Disposition」,「attachment; filename = LeftCorner.jpg」);

bmp.Save(Response.OutputStream, ImageFormat.Jpeg);

顯然你只是改變擴展名。

相關問題