Click here to Skip to main content
11,790,021 members (38,664 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads
Add your own
alternative version

Upload files using an HttpHandler

, 9 Dec 2009 CPOL 84.1K 3.3K 36
Using an HttpHandler to upload a file.
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");
                for (int i = 0; i < context.Request.Files.Count; ++i)
                    HttpPostedFile file = context.Request.Files[i];
                    context.Response.Write("File uploaded");

        public bool IsReusable
                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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ritesh Ramesh
Architect Infosolvex Solutions Inc
Australia Australia
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

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1509028.1 | Last Updated 9 Dec 2009
Article Copyright 2009 by Ritesh Ramesh
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid