Torna al Thread

[CODE] public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Expires = -1; string type = context.Request["type"]; string id = context.Request["id"]; string result = string.Empty; if (context.Request.Files.Count == 0) { context.Response.ContentType = "text/plain"; context.Response.Write("{\"msg_error\":\"" + Messaggi.ERR_NO_FILE + "\"}"); } else { HttpPostedFile uploadedfile = context.Request.Files["Filedata"]; if (uploadedfile != null && uploadedfile.ContentLength > 0) { string FileName = uploadedfile.FileName; string FileType = uploadedfile.ContentType; int FileSize = uploadedfile.ContentLength; string id_item = "0"; string name = string.Empty; string filename = string.Empty; string link = string.Empty; string error = string.Empty; List<string> msg_error = new List<string>(); List<string> param = new List<string>(); LogRequest(FileName + ", " + FileType + ", " + FileSize); switch (type) { case "video_news": string _title = context.Request["title"]; string _title_old = context.Request["title_old"]; string _category = context.Request["category"]; _category = _category; string _description = context.Request["description"]; string _keywords = context.Request["keywords"]; tipoYouTubeVideo _video = new tipoYouTubeVideo(); _video.Title = _title; _video.TitleOld = _title_old; _video.Category = _category; _video.Description = _description; _video.Keywords = _keywords; _video.Upload = uploadedfile; if (News.salvaVideo(_video, out msg_error)) { id_item = _video.VideoId; name = _title; filename = _video.Image; link = _video.Watch; } else { msg_error.ForEach(item => error += (!string.IsNullOrEmpty(error) ? "\r\n" : string.Empty) + item); } break; default: break; } if (id_item != "0" && id_item != string.Empty) result = "{\"id_item\":\"" + id_item + "\",\"name\":\"" + name + "\",\"filename\":\"" + filename + "\",\"link\":\"" + link + "\",\"msg_error\":\"" + error + "\"}"; else result = "{\"id_item\":\"\",\"name\":\"\",\"filename\":\"\",\"link\":\"\",\"msg_error\":\"" + error + "\"}"; } else { result = "{\"msg_error\":\"" + Messaggi.ERR_DESC_ZERO_LENGTH_FILE + "\"}"; } context.Response.ContentType = "text/plain"; context.Response.Write(result); } } [/CODE]
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5