|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace UploadHttphandler
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string filePath = "FileSave//";
//write your handler implementation here.
if (context.Request.Files.Count <= 0)
{
context.Response.Write("No file uploaded");
}
else
{
for (int i = 0; i < context.Request.Files.Count; ++i)
{
HttpPostedFile file = context.Request.Files[i];
file.SaveAs(context.Server.MapPath(filePath+file.FileName));
context.Response.Write("File uploaded");
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ritesh is an IT consultant with over ten years of experience in the IT industry varying from consultation, architecture, design, development to technical management. He has a strong background in solutions and applications architecture with a focus on Microsoft’s .Net platform. His area of expertise spans design and implementation of client/server, database and web-based systems. He has worked with C#, ASP.NET 1.1 and 2.0, ADO.NET, Web Services and SQL technology on several enterprise class projects.
Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi