The Http process will be used to save the image in database.Here one more class is used to do the data base functionality and The GetUploadBinary method is used to update the image data in data base
public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; if (context.Request.Files.Count == 0) { context.Response.Write("No files uploaded."); return; } int id; if (String.IsNullOrEmpty(context.Request.QueryString["itemId"]) || !Int32.TryParse(context.Request.QueryString["itemId"], out id)) { context.Response.Write("No item id provided."); return; } TestDataContext tdc = new TestDataContext(Config.ConnectionString); Orders item = tdc.Orders.FirstOrDefault(p => p.ID.Equals(id)); if (item == null) { context.Response.Write("Item not found."); return; } item.Image = SiteUtility.GetUploadBinary(context.Request.Files[0]); item.ImageType = context.Request.Files[0].ContentType; tdc.SubmitChanges(); }
2 comments:
Hey there, You've done an incredible job. I will definitely digg it and in my opinion recommend to my friends. I am confident they will be benefited from this web site.
my web page - garvalin kids
Thanks for your comment.
Post a Comment