Sony Arouje

a programmer's log

Image uploading & Retrieving – Silverlight and WCF

with 9 comments

In several forums I saw people asking about how we can upload Images or files to server using silverlight. So I thought of writing one to demonstrate how we can achieve it. I become a big fan of caliburn micro and I used it in this app as well.

In this demo app I demonstrating both approach of accessing WCF service – Proxy less and Proxy approach. I personally like Proxy less approach so I cannot avoid it here also.

Let’s go through my solution structure


Repository: This project contains entities and persistence classes. I made it as simple as possible in this demo, so all the persistence related stuff is in the same project.

WCFService: Project contains the service implementation

WCFService.Interfaces: project contains the service contracts.

WCFHost: Project host the WCF service.

In Silverlight folder I have a Project called ServiceLinkProject, that is a project that has link to entity files. It is used for Proxy less WCF communication. In this demo I used my generic repository mentioned in my previous post.

There is nothing much to explain here except the valueconverter I used in the xaml page. I save and retrieve images as byte arrays. But silverlight’s Image control will not be able to render byte arrays. So wrote a Converter inherited from IValueConverter. Let’s see how am using it.

First I created an instance of the converter.

        <converter:ByteToImageConverter x:Name="binaryConverter"/>


Now use this converter while binding the byte[] to image.

<Image x:Name="thumbNail"  Width="100" Height="100" VerticalAlignment="Center" Source="{Binding ImageInBytes,Converter={StaticResource binaryConverter}}"></Image>

I think this project doesn’t requires much explanation. If any one has any questions then am happy to help you out.

Download Source code

Written by Sony Arouje

October 16, 2010 at 4:04 am

9 Responses

Subscribe to comments with RSS.

  1. […] This post was mentioned on Twitter by Larry King, sony arouje. sony arouje said: Image uploading & Retrieving – Silverlight and WCF: […]

  2. […] I wrote to upload images using Silverlight and WCF, you can get more details of that app from my blog. I will rewrite only the part where I make async calls to server to get images from WCF service. […]

  3. Hi. I could not compile the source code. I’m getting all kinds of errors. Is there anything missing from the source code folder to compile in Visual Studio 2010? Thanks!

    Marcus McElhaney

    February 18, 2011 at 12:22 am

    • Hi Marcus,
      I am not sure what kind of errors you are getting. You need to run WCFServiceHost project first, then start Image_Fetch_DB.Web project. If still not working post the errors here.


      February 18, 2011 at 11:15 am

  4. hi to all sonyarouje.comers this is my first post and thought i would say hi –
    speak soon
    garry moore


    November 26, 2011 at 10:04 pm

  5. It worked, thanks a lot.


    September 29, 2012 at 8:41 am

  6. unable to download the sample can you send the download link


    October 7, 2014 at 11:34 pm

    • Hi Ramesh,
      Updated the source code link, link got changed when MS moved to OneDrive.

      Sony Arouje

      Sony Arouje

      October 8, 2014 at 2:14 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: