常用基本功能:
利用ASP.NET的FileUpload上傳Binary資料的圖片,存放在Image欄位型態的資料庫裡,並且結合ashx handler來瀏覽圖片
using System;
using System.Web;
using System.Data;
public class movieimg : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "image/jpeg";
if (context.Request["mid"] != null)
{
Select_Object.GetMovieImage gmi =
new Select_Object.GetMovieImage(context.Request["mid"]);
DataTable img = gmi.GetData();
if (img != null)
{
context.Response.BinaryWrite((byte[])img.Rows[0][0]);
}
}
//context.Response.Write("Hello World");
}
public bool IsReusable {
get {
return false;
}
}
}
沒有留言:
張貼留言
留個話吧:)