Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6608605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:37:39+00:00 2026-05-25T19:37:39+00:00

I have constructed a method that takes a local file and posts it to

  • 0

I have constructed a method that takes a local file and posts it to a remote site taken from the 2nd answer here.

On the remote site, I have my HttpHandler but do not know where the file bytes are so I can save it somewhere on the remote machine.

Can someone help me on how to consume that file in the HttpHandler for processing? I tried the below but Request.Files is empty:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections.Specialized;

namespace Somewhere
{
    public class UploadFileHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //VALIDATE FILES IN REQUEST
            if (context.Request.Files.Count > 0)
            {
                //HANDLE EACH FILE IN THE REQUEST
                foreach (HttpPostedFile item in context.Request.Files)
                {
                    item.SaveAs(context.Server.MapPath("~/Temp/" + item.FileName));
                    context.Response.Write("File uploaded");
                }
            }
            else
            {
                //NO FILES IN REQUEST TO HANDLE
                context.Response.Write("No file uploaded");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:37:40+00:00Added an answer on May 25, 2026 at 7:37 pm

    Get hold of the HttpRequest from the context, and use the Files property to get a collection of HttpPostedFile objects. You can then access the data from HttpPostedFile.InputStream (there are other properties for the name, length and MIME type).

    EDIT: Now that the question’s been edited to show that you’re already using the Files property, I strongly suspect that you’re looking at the wrong HTTP request, or that there’s something wrong with how you’re making the request. I suggest you use Wireshark to see what’s happening at the network level – that way you can check that your request really has the file data in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Python Decimal doesn't support being constructed from float; it expects that you have to
Greetings, I have a particular object which can be constructed from a file, as
I have a junit test method that takes a CommonsMultipartFile object as a parameter.
I have a method that takes List<Foobar> and Foobar as parameters. Foobar is a
My case is that i have a method that takes Collection and i have
I have a method in C# that says FormatSSN that takes a SSN in
I have constructed an XML tree structure of an XML file. I am able
I wanted to run a .cmd file from Java. I have something which works
Summary I have written a process monitor command-line application that takes as parameters: The
I have a report that takes about 2 or 3 minutes to pull all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.