protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; try { HttpPostedFile file = Request.Files["uploaded"]; ZipFile zipFile = ZipFile.Read(file.InputStream); StringBuilder zipContent = new StringBuilder(); foreach (var zipEntry in zipFile.Entries) { MemoryStream memoryStream = new MemoryStream(); zipEntry.Extract(memoryStream); memoryStream.Position = 0; StreamReader reader = new StreamReader(memoryStream); zipContent.AppendLine(reader.ReadToEnd()); } FileUploadContext db = new FileUploadContext(); db.Files.Add(new Models.File() { Content = zipContent.ToString() }); db.SaveChanges(); Response.ContentType = "application/json"; Response.Write("{}"); } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_PreRender(object sender, EventArgs e) { FileUploadContext db = new FileUploadContext(); StringBuilder sb = new StringBuilder(); foreach (var item in db.Files) { sb.AppendFormat("{0}. <br/>", item.Id); sb.AppendFormat("{0} <br/>", item.Content); } this.FileOutput = sb.ToString(); }
public DeleteModel(FileUpload.Models.FileUploadContext context) { _context = context; }
public EditModel(FileUpload.Models.FileUploadContext context) { _context = context; }
public CreateModel(FileUpload.Models.FileUploadContext context) { _context = context; }
public IndexModel(FileUpload.Models.FileUploadContext context) { _context = context; }
public DetailsModel(FileUpload.Models.FileUploadContext context) { _context = context; }