Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / C#

Zeta Uploader Windows Client

Rate me:
Please Sign up or sign in to vote.
4.67/5 (17 votes)
30 Jul 2011CPOL7 min read 115.2K   1.7K   59   31
Introducing the Windows Client for the Zeta Uploader service

zeta-uploader-02-en-small.jpg

Screenshot of the web-based frontend

Introduction

In this article I'll show you the functions and the internals of the Windows client of our free Zeta Uploader service. While this is (of course) some kind of promotion of the service itself, I'm really sure that the code discussed here could be of some value to other readers.

The download for this article enables you to completely set up a client-server scenario in your own environment, without any connection to our services.

What is Zeta Uploader?

Zeta Uploader is a central service running on our web server to which you can upload large files and let it generate e-mail messages with a download link.

The basic idea is to avoid sending files, especially large files by e-mail but instead upload it to the Zeta Uploader website and send the receiver simply a download link to the actual file.

E-mail attachments do have limitations both in size and content, since most accounts limit the maximum attachment size to some few MB. Also usually some kind of file attachments are blocked, e.g. executable files. By using Zeta Uploader, a user can avoid these limitations.

Background

I started developing this service approximately a year ago when I was in need of sending larger files to some of our customers. Since the customer's e-mail server rejected my attachments (because of the size), I started quickly hacking together the initial website and a web form to upload a file.

I wasn't aware that there are already a few other services like mine, namely YouSendIt or RapidShare. Maybe I wouldn't have developed the service at all, if I knew these before.

Zeta Uploader has a few advantages over these other services, at least in my opinion: You don't need the create any account at all - simply upload and you're done. In addition, our service is completely free. Third, the Windows client I'm discussing in this article is a feature that the other services seems to miss, too. Last, we delete the uploaded files automatically after 30 days, which seems to be later than other services.

Please note that I don't plan to make any money from the service at all. It is simply a tool that I developed due to my own needs and which I think of as being a benefit to other users, too.

But now on to the application itself...

The components of Zeta Uploader

Zeta Uploader consists of three parts:

  • A website with some web forms to upload a file through any web browser. Directly accessible at www.zeta-uploader.com
  • A Windows client to install on your local machine to upload multiple files and/or folders by a few simple clicks in the Windows Explorer
  • A web service with which the Windows clients communicate to upload the data

This article discusses the latter two.

The Windows client

zeta-uploader-01-en.png

Screenshot of the Windows-based frontend

The Windows client is a Microsoft .NET Framework 2.0 Windows Forms application, i.e. in order to use, the .NET Framework must be installed on the system.

Once installed, the user has several options to upload a file:

  • Select multiple files and/or folders in Windows Explorer, then right-click and select "Send to" | "Upload with Zeta Uploader".
  • Start the Windows client from the start menu and add files and folders interactively through the "add" menu item.
  • Start the Windows client from the start menu and add files and folders by using drag and drop.

Once the user enters one or multiple receivers and adds an optional comment, he clicks the "Upload now" button.

All selected files and folders are locally compressed into a single ZIP file to reduce the size of the upload. After the compression, the compressed single file is uploaded via web services calls (SOAP) to the server.

The web service

The web service consists of the web service itself on the web server (ASMX file) and of the wrapper classes (the "proxy" classes) that are being used inside the Windows client to communicate with the web service.

I selected SOAP as the communication protocol (in contrast to e.g. FTP) because it has multiple benefits like really-easy development within Visual Studio .NET and since it is based on HTTP which most firewalls just easily allow to pass through.

Chunked uploads

Since I developed several upload functions inside other customer projects in the past, that are based on SOAP, too, I was aware that it is not "that" simple:

The most naive approach for uploading a file would be to have a web method like this one:

C#
[WebMethod]
public void UploadFile( byte[] fileContent, string fileName );

Unfortunately this failed several times in the past: Especially when uploading large files, it is rather likely that the upload will be interrupted during the processing, due to several reasons (I remember one reason was a bloody ISA server on a heavily out-of-date server - I do hate this server personally!)

So I developed a different approach to make it more error-tolerant:

  • Instead of uploading one giant block of bytes, the upload process now sends multiple smaller blocks ("chunks"), currently 50 KB per block
  • In addition, each block could fail multiple times (currently 4 times) before the complete upload is being considered as failed. This allows for temporary connection problems without cancelling the complete upload
  • A global retry counter limits to total number of retries so that a permanent network error is detected by the system, too
  • Each uploaded block contains an ascending block number, enabling the server to detect lost packets

To encapsulate this functionality, I put the classes for the client part into a separate library called "ClientLib".

Image 3

Structure of the "ClientLib" Visual Studio project

The web part is contained within the web project called "Web".

Image 4

Structure of the "Web" Visual Studio project

Of course you'll find both projects in the download to this article.

Since I find it rather boring to read CodeProject articles with lot of code, I don't do this either and recommend that you simply download the article's code and open it inside Visual Studio .NET 2005.

What you can do with the code

You have several things that you could do with the code:

For example you could take the core web service communication library and put it into your own projects where you need error-tolerant upload functionality. Then you can even enhance the upload process further; e.g. in another project I implemented the ability to continue a previously interrupted upload. In yet another project I also built an error-tolerant "download", working similar to the upload of the Zeta Uploader.

Another option would be to simply take the source of the Windows client and enhance it or include it in your own application, while still communicating with the web server on "our" server. So you just enhance the client but re-use the server.

Last, you could just take the source code and build your own complete stand-alone environment where you set up your own web server and compile your own (possibly enhanced) Windows client.

And of course there are surely several other things you can do with the code that I simply cannot think of...

Web page code

Please note that I did omit the web pages from the article's download. These are the pages you see when navigating your browser to www.zeta-uploader.com. I did this, because I think that it is rather special to our own server and you'll get few, if any, benefits from downloading this code.

If you still require it, please drop me a line.

Conclusion

In this article I presented you the functions and some of the internals of the Zeta Uploader. I strongly hope this article is of some value and doesn't count as pure, stupid advertisement (to be honest, I'm not sure either, now after having written it...).

Anyway, I would be more than happy to get your feedback in the comments section at the end of this article. Feel free to ask your questions, provide me with suggestions and enhancements.

Of course you could use this code for whatever you want, no license or credits required (but I certainly would be glad to get a note if you developed a cool project with it).

History

  • 2011-07-30: Updated screenshot and some minor text changes.
  • 2007-05-01: Added complementary article about the content detection library.
  • 2007-04-28: Initial release of the article.

License

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


Written By
Chief Technology Officer Zeta Software GmbH
Germany Germany
Uwe does programming since 1989 with experiences in Assembler, C++, MFC and lots of web- and database stuff and now uses ASP.NET and C# extensively, too. He has also teached programming to students at the local university.

➡️ Give me a tip 🙂

In his free time, he does climbing, running and mountain biking. In 2012 he became a father of a cute boy and in 2014 of an awesome girl.

Some cool, free software from us:

Windows 10 Ereignisanzeige  
German Developer Community  
Free Test Management Software - Intuitive, competitive, Test Plans.  
Homepage erstellen - Intuitive, very easy to use.  
Offline-Homepage-Baukasten

Comments and Discussions

 
QuestionIs it privacy aware ? Pin
Mazen el Senih1-Apr-12 23:42
professionalMazen el Senih1-Apr-12 23:42 
AnswerRe: Is it privacy aware ? Pin
Uwe Keim2-Apr-12 0:14
sitebuilderUwe Keim2-Apr-12 0:14 
AnswerRe: Is it privacy aware ? Pin
Mazen el Senih2-Apr-12 0:52
professionalMazen el Senih2-Apr-12 0:52 
GeneralRe: Is it privacy aware ? Pin
Uwe Keim2-Apr-12 0:54
sitebuilderUwe Keim2-Apr-12 0:54 
GeneralRe: Is it privacy aware ? Pin
Mazen el Senih2-Apr-12 1:03
professionalMazen el Senih2-Apr-12 1:03 
Generali don't like ASPX for uploaders Pin
el3ashe23-Apr-10 15:37
el3ashe23-Apr-10 15:37 
QuestionPoll:: Would you avoid this service if it required one-time-signup? Pin
Uwe Keim3-May-07 8:13
sitebuilderUwe Keim3-May-07 8:13 
AnswerRe: Poll:: Would you avoid this service if it required one-time-signup? Pin
Phil.Benson6-May-07 21:47
professionalPhil.Benson6-May-07 21:47 
AnswerRe: Poll:: Would you avoid this service if it required one-time-signup? Pin
Galatei2-Aug-11 12:20
Galatei2-Aug-11 12:20 
GeneralRe: Poll:: Would you avoid this service if it required one-time-signup? Pin
Uwe Keim2-Aug-11 19:21
sitebuilderUwe Keim2-Aug-11 19:21 
GeneralDownload Problems Pin
tigert2-May-07 3:33
tigert2-May-07 3:33 
GeneralRe: Download Problems Pin
Uwe Keim2-May-07 4:18
sitebuilderUwe Keim2-May-07 4:18 
GeneralRe: Download Problems Pin
tigertaylor2-May-07 4:20
tigertaylor2-May-07 4:20 
GeneralCulture problems Pin
Väinölä Harri30-Apr-07 0:46
Väinölä Harri30-Apr-07 0:46 
GeneralRe: Culture problems Pin
Uwe Keim30-Apr-07 1:04
sitebuilderUwe Keim30-Apr-07 1:04 
GeneralRe: Culture problems Pin
Väinölä Harri30-Apr-07 1:13
Väinölä Harri30-Apr-07 1:13 
GeneralRe: Culture problems Pin
Uwe Keim30-Apr-07 1:23
sitebuilderUwe Keim30-Apr-07 1:23 
GeneralRe: Culture problems Pin
Väinölä Harri30-Apr-07 1:32
Väinölä Harri30-Apr-07 1:32 
GeneralRe: Culture problems Pin
Uwe Keim30-Apr-07 1:32
sitebuilderUwe Keim30-Apr-07 1:32 
GeneralRe: Culture problems Pin
kurimus1-May-07 22:39
kurimus1-May-07 22:39 
GeneralRe: Culture problems Pin
Uwe Keim1-May-07 23:01
sitebuilderUwe Keim1-May-07 23:01 
Generalzeta Pin
YoSilver28-Apr-07 12:03
YoSilver28-Apr-07 12:03 
GeneralRe: zeta Pin
Uwe Keim28-Apr-07 20:43
sitebuilderUwe Keim28-Apr-07 20:43 
GeneralRe: zeta Pin
Phil.Benson28-Apr-07 21:50
professionalPhil.Benson28-Apr-07 21:50 
GeneralRe: zeta Pin
Uwe Keim28-Apr-07 21:54
sitebuilderUwe Keim28-Apr-07 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.