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

  • SEARCH
  • Home
  • 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 349953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:30:22+00:00 2026-05-12T11:30:22+00:00

Does anyone know, or better yet have an example, of a WCF service that

  • 0

Does anyone know, or better yet have an example, of a WCF service that will accept a form post encoded multipart/form-data ie. a file upload from a web page?

I have come up empty on google.

Ta, Ant

  • 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-12T11:30:22+00:00Added an answer on May 12, 2026 at 11:30 am

    So, here goes…

    Create your service contract which an operation which accepts a stream for its only parameter, decorate with WebInvoke as below

    [ServiceContract]
    public interface IService1 {
    
        [OperationContract]
        [WebInvoke(
            Method = "POST",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "/Upload")]
        void Upload(Stream data);
    
    }
    

    Create the class…

        public class Service1 : IService1 {
    
        public void Upload(Stream data) {
    
            // Get header info from WebOperationContext.Current.IncomingRequest.Headers
            // open and decode the multipart data, save to the desired place
        }
    

    And the config, to accept streamed data, and the maximum size

    <system.serviceModel>
       <bindings>
         <webHttpBinding>
           <binding name="WebConfiguration" 
                    maxBufferSize="65536" 
                    maxReceivedMessageSize="2000000000"
                    transferMode="Streamed">
           </binding>
         </webHttpBinding>
       </bindings>
       <behaviors>
         <endpointBehaviors>
           <behavior name="WebBehavior">
             <webHttp />         
           </behavior>
         </endpointBehaviors>
         <serviceBehaviors>
           <behavior name="Sandbox.WCFUpload.Web.Service1Behavior">
             <serviceMetadata httpGetEnabled="true" httpGetUrl="" />
             <serviceDebug includeExceptionDetailInFaults="false" />
           </behavior>
         </serviceBehaviors>
       </behaviors>
       <services>     
         <service name="Sandbox.WCFUpload.Web.Service1" behaviorConfiguration="Sandbox.WCFUpload.Web.Service1Behavior">
          <endpoint 
            address=""
            binding="webHttpBinding" 
            behaviorConfiguration="WebBehavior"
            bindingConfiguration="WebConfiguration"
            contract="Sandbox.WCFUpload.Web.IService1" />
        </service>
      </services>
     </system.serviceModel>
    

    Also in the System.Web increase the amount of data allowed in System.Web

    <system.web>
            <otherStuff>...</otherStuff>
            <httpRuntime maxRequestLength="2000000"/>
    </system.web>
    

    This is just the basics, but allows for the addition of a Progress method to show an ajax progress bar and you may want to add some security.

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

Sidebar

Related Questions

Does anyone know a better (shorter/more elegant) way than simply writing a loop and
Does anyone know why UsernameExists wont return True. I must have my syntax messed
Does anyone know of any websites, or (preferably) downloadable packages that you can use
There doesn't seem to be a dictionary.AddRange() method. Does anyone know a better way
Does anyone know if there is a way to generate different code in the
Does anyone know of a free tool, similar to what is built into Visual
Does anyone know of a mechanism in Sybase ASA 9 / Sybase SQL Anywhere
Does anyone know of a way to contain a nonbreaking space in an html
Does anyone know how to make entity_id visible on the frontend as a sortable
Does anyone know of a good way to assert if a NameValueCollection is equivalent?

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.