Torna al Thread

public void ProcessRequest(HttpContext context) { string type = context.Request["type"]; string id = context.Request["id"]; if (context.Request.Files.Count == 0) { LogRequest("Nessun file selezionato"); context.Response.ContentType = "text/plain"; context.Response.Write("Nessun file selezionato"); } else { HttpPostedFile uploadedfile = context.Request.Files[0]; string FileName = uploadedfile.FileName; string FileType = uploadedfile.ContentType; int FileSize = uploadedfile.ContentLength; string id_photo = "0"; string imgSmall = string.Empty; string result = string.Empty; LogRequest(FileName + ", " + FileType + ", " + FileSize); switch (type) { case "news": tipoNewsPhoto photo = new tipoNewsPhoto(); photo.ImmagineUpLoad = uploadedfile; photo.Descrizione = string.Empty; photo.Posizione = "0"; photo.Id_Photo = News.SalvaPhoto(photo); id_photo = photo.Id_Photo; imgSmall = photo.Immagine_Small; break; } if(id_photo != "0" && id_photo != string.Empty) result = "{\"name\":\"" + imgSmall + "\",\"type\":\"" + FileType + "\",\"size\":\"" + FileSize + "\",\"id_photo\":\"" + id_photo + "\"}"; else result = "{\"name\":\"\",\"type\":\"\",\"size\":\"\",\"id_photo\":\"0\"}"; context.Response.ContentType = "text/plain"; context.Response.Write(result); } }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5