File upload in chunks - how to adapt codeproject file written for to run on web?

So I downloaded the files from codeproject for the "upload files in chunks" application at

I've adapted the c# code into and tests I run locally show it working ok.  Trouble is, the client side was written for windows application level client, not web, so I'm wondering if anyone has already got a bit of client side web coding to take an uploaded file and split it into chunks that is compatible with this web service at all?

12/19/2007 2:29:46 PM 7071 articles. 0 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 18
Get it on Google Play
Get it on Apple App Store

Well I use MTOM and WSE 3.0 to send files in chuncks across the wire to a web service and here are some of the things I did on the client side:

1.  Right-click project and go to 'WSE 3.0 Settings' and check 'Enable this project for Web Services Enhancements' on the 'General' tab, and on the 'Messaging' tab set Client Mode to 'On' (I have server mode set to 'Always'

2.  I use an array of byte arrays that I read the files into to accept in the web service.  Look at some of my sample code:


Imports System.Web.Services.Protocols
Imports Microsoft.Web.Services3
Imports Microsoft.Web.Services3.Security       

                'Derive the client from Microsoft.Web.Services3.WebServicesClientProtocol (ServiceWse)
                'This allows access to the MTOM protocol for sending files (attachments) to the server
                Dim ws As New MyWebService.MyWebServiceWse
                'Represents the system credentials for the current security context in which the application is running.
                'The default credentials are the user credentials of the logged-in user, or the user being impersonated.
                ws.Credentials = CredentialCache.DefaultCredentials  (Only used for Windows Authentication, build Credential object if otherwise)
                'Indicates to send authentication information with subsequent requests without waiting to be challenged by the server.
                ws.PreAuthenticate = True

                'Specify that MTOM encoding must be used; this is the protocol used for sending attachments to the web service.
                ws.RequireMtom = True

                'Build a string array of the file names to be attached.
                'IMPORTANT: The names in the array must be in the same order that the file content is added below
                Dim strFileNames() As String = {"TestAttachment1.txt", "TestAttachment2.txt", "Test.doc"}

                'Create an array of Byte arrays. Each byte array will hold the contents of a file
                Dim AllAttachments()() As Byte = Nothing
                'Create individual Byte arrays; 1 for each attachment needed
                Dim Attachment1(), Attachment2(), Attachment3() As Byte
                'Read the contents of the file into a Byte Array object
                Attachment1 = File.ReadAllBytes("C:\TestAttachment1.txt")
                Attachment2 = File.ReadAllBytes("C:\TestAttachment2.txt")
                Attachment3 = File.ReadAllBytes("C:\Test.doc")

                'Add all the individual Byte Arrays to the main array.
                'Add the items in the order corresponding to the file names in strFileNames()
                AllAttachments = New Byte()() {Attachment1, Attachment2, Attachment3}

                'Indicates the time an XML Web service client waits for a synchronous XML Web service request to complete (in milliseconds)
                'Use Infinite so lengthy calls do not time out.
                ws.Timeout = System.Threading.Timeout.Infinite
                'Call the SendFiles web service function
                ws.SendFiles(AllAttachments, strFileNames)

                'Clean Up
                AllAttachments = Nothing
            Catch ex As SoapException
                'Handle exception as needed
            Catch ex As Exception
                'Handle exception as needed
            End Try
 Hope this helps,
Thank you,

12/19/2007 5:04:12 PM

hmm... whereabouts am I "right clicking" though!?  I'm using Visual Web Developer Express...

12/19/2007 6:46:50 PM

In Visual Studio's 'Soultion Explorer' window, right-click your project name to get the dropdown of available actions.  The last one shown to me is 'WSE Settings 3.0...'.  You will have to have WSE 3.0 installed to see the option, but since you have been working with it already you should have it.  Having the Express edition should not matter. Solution Explorer is the window in the IDE where you can select all of your forms, classes, config files, etc.

Thank you,

12/19/2007 8:29:45 PM


 I need this "File upload in chunks" project that was not available to download from  I had read this article one month before and I stored the link of the page. Now I am trying to download the article, but the link return "the requested page not found".

Please send the Source Code and also any related articles available to this project to my email address. Email :

Thanks & Regards,



1/19/2008 12:07:34 PM
1/19/2008 12:18:31 PM

Similar Artilces:

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: Hope this helps....

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

File Upload web service... 2005?
I have a web service that receives file uploads as dime attachments which was written with 2003 for .net framework 1.1.  It runs into the same file size limitations that you get in a regular web application.  I had heard a rumor that 2005 with .net framework 2.0 would fix the large file upload limitation problem, and hopefully use less server memory by chunking incoming files also.  Has anyone been able to confirm or deny this?  I would like to know before going to the trouble of installing the new version and making whatever changes it wants. ...

How to send an XML file to a Web Service (that records the XML file to HD)
I did this because I wanted to send an XML file to another computer, whether it be next to the one I’m using  or in another country. You will need to adapt my example in order for it to work as you want it. All I demonstrate here is that it is possible to send an XML file to another computer using XML Web Services. Let me know if it works for you. The code assumes you can use Visual Studio. Make the Web Service 1. Make a new project, choosing to make a Web Service. 2. In the code behind-page, place the code below. 3. Build the Web Service. Code: <WebMethod()>...

is it possible to exporting XML file from a website to windows application through .Net Remoting or web services
Hello everyone ..i have a website through which i want interact with a desktop appplication to send a XML file.With .Net Remoting i think it's possible but abt webservices i m nt sure is it possible with .Net Remoting or Web Services???plz clear me abt it.    Possible with web services. Expose a web method and add a reference to the webservice to your windows application and call the web methodJeev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~If you get the answer to your question, please mark it as the answer.  Hello Jeev..sorry for replying late.But I think my scenari... web project
Hi All, I have a situation in my web application whereby after accepting username & password from user I want to create a text file on web server and then upload it to somewhere via ftp? Any one can help me doing this please? Best Regards, Usman Why dont you have a Web Service on the server that creates the text file and then make an instance of it when someone login that is creating the file.Mikael Söderström...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

REVIEW: Real World XML Web Services for VB and VB.NET Developers
Real World XML Web Services: For VB and VB .NET Developers by Yasser Shohoud Addison-Wesley Pub Co Web Services. I can't believe there is anyone left alive in the technology sector that hasn't heard these two words. Everywhere you look there are articles, books, and web sites that talk about this technology. Do a book search for "Web Services" on and you will be quite amazed how many Web Services books there are. With so many available picking one buy may seem overwhelming. The good news is it just got a little easier to do. Real World ...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

Run Web app using Web Harpoon
Does anyone know what Begin Tag and End Tag to use to run a VB.Net web App in Web Harpoon? We are experiencing errors trying to run the app. Error --> The state information is invalid for this page and might be corrupted Thanks,   Erik...

Sending a PDF file to a .NET web service
How can I send a PDF file to a .NET web service ? I created a .NET web method to accept a file stream. Appreciate any comments or suggestions. Thanks, Eric.- You'd have to read the PDF into a single blob variable and pass that. On 11 Mar 2007 20:11:56 -0800, Eric Sulistiawan wrote: >How can I send a PDF file to a .NET web service ? I created >a .NET web method to accept a file stream. Appreciate any >comments or suggestions. > >Thanks, >Eric.- Thanks for the suggestion. What would be the corresponding data type on the .NET web method to receive the...

serialize a XML file to a VB.NET file (class) using xsd
Hello   I would like to serialize  a XML file to a VB.NET  file (class).   How can I use XSD.exe  to generate my xml file  C:\leye_g\Travaux\Fichiers de données\test.xml  to a VB.NET File ?   Best regardsf Hi XML Schema Definition Tool (Xsd.exe)  can generate runtime classes from  XSD files . XmlElementAttribute Is Missing for the Generated Class Members While Using Xsd.exe describes how to generate class from xml and reports a problem. And you could find more info here: Code Generation in the .NET Framework Using XML Sch...

How can I run a .aspx file from .vb file in visual ?
Hello,     I want to make a program which can run an .aspx file whenever a new flash file is put into the directory.  I already finish the IO.FileSystemWatcher part.  But when I detect a new file is put into the folder, how can I activate a .aspx program from . Robert Chu...

how to create web service that create xml files availible for web application
Hi epxerts im new in web service. I have a web link which contains nothing when you visit that web link. But when you view the source it will show the xml source in it. I want to create that xml file through web service and make these xml files availible for my application. Best RegardsShaukat Waqar...

Web resources about - File upload in chunks - how to adapt codeproject file written for to run on web? -

CodeProject® - Your Development Resource
Free source code and tutorials for Software developers and Architects.; Updated: 4 Jun 2012

CodeProject (@codeproject) on Twitter
Log in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here CodeProject @ codeproject ...

CodeProject Interview With Me
I was recently interviewed by CodeProject who run a weekly interview series in which they talk with developers about their backgrounds, interests ...

Language Integrated Query - Wikipedia, the free encyclopedia
Language Integrated Query ( LINQ , pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to ...

If you are looking to learn WPF, its time to start on today. I have put all my articles on WPF in Codeproject, which you might find interesting ...

How to choose javascript frameworks
This will tell you various javascript framework and how can you choose yours, also shows comparison between various frameworks and libraries ...

AuthorListing.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Has programming lost its way?
... I use is not Metro-ready yet, I had no choice but to play around with Visual Studio. I am no stranger to Windows. I visit websites like CodeProject ...

Hashtables Undocumented
... discoveries from playing around with .NET libraries, Anakrino, and the Rotor source files to the words. I have a few lengthy articles in CodeProject ...

Avoid Testing Implementation Details, Test Behaviours
Every so often I return to Kent Beck’s Test-Driven Development . I honestly believe it to be one of the finest software development books ever ...

Resources last updated: 11/23/2015 12:25:23 PM