Initial commit
This commit is contained in:
66
Administration/saveFilescsv.ashx.cs
Normal file
66
Administration/saveFilescsv.ashx.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace QW2021C.Administration
|
||||
{
|
||||
/// <summary>
|
||||
/// Zusammenfassungsbeschreibung für saveFiles
|
||||
/// </summary>
|
||||
public class saveFilescsv : IHttpHandler
|
||||
{
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
string targetFolder = HttpContext.Current.Server.MapPath("~/Upload");
|
||||
|
||||
HttpRequest request = context.Request;
|
||||
|
||||
HttpFileCollection uploadedFiles = context.Request.Files;
|
||||
|
||||
if (uploadedFiles != null && uploadedFiles.Count > 0)
|
||||
|
||||
{
|
||||
|
||||
for (int i = 0; i < uploadedFiles.Count; i++)
|
||||
|
||||
{
|
||||
|
||||
if (uploadedFiles[i].FileName != null && uploadedFiles[i].FileName != "")
|
||||
|
||||
{
|
||||
|
||||
string fileName = uploadedFiles[i].FileName;
|
||||
|
||||
int index = fileName.LastIndexOf("\\");
|
||||
|
||||
if (index > -1)
|
||||
|
||||
{
|
||||
|
||||
fileName = fileName.Substring(index + 1);
|
||||
|
||||
}
|
||||
|
||||
uploadedFiles[i].SaveAs(targetFolder + "\\" + fileName);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user