Beispiel #1
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         var temp = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString("d") + ".xlsx";
         try
         {
             for (int i = 0; i < context.Request.Files.Count; i++)
             {
                 var file = context.Request.Files[i];
                 file.SaveAs(temp);
                 var excel = new ExcelManager();
                 excel.Import(temp);
             }
         }
         finally
         {
             System.IO.File.Delete(temp);
         }
         context.Response.ContentType = "text/plain";
         context.Response.Write("アップロードされました。");
     }
     catch (Exception ex)
     {
         context.Response.ContentType = "text/plain";
         context.Response.Write(ex.Message);
     }
 }