Equivalent of UploadedFileProcessorType in pure SilverLight

Dec 31, 2009 at 8:20 PM

Hi there. First - thanks very much for this control - I agree with your comments that other, similar, controls on CodePlex don't have sufficient documentation on how to get them to work in an existing project.

Now to my question; it seems (correct me if I'm wrong) that your control is expected to be used in an HTML file, with Javascript enabled. I've played with the UploadedFileProcessorType in such a file and all works good.

In my project, though, it's all SilverLight (other than the kickoff page, of course). Is there an equivalent to UploadedFileProcessorType that I could fire either in the SilverLight client, or in the Web Project? I can't see how I can deduce that files have transferred without resorting to Javascript.




Dec 31, 2009 at 9:15 PM

While the examples are centered around using FileUploaderControl "standalone", where it acts as a control on an aspx/html page, at its core it is just another silverlight user control that can be used from within a silverlight app.

That said, the examples provided are not set up for that scenario.  I'll try to give you the quick version:

1. Place a FileUploaderControl wherever you would like it in your silverlight app.

2. In code-behind for whatever xaml page is hosting it, specify its properties appropriately.  The provided examples use an asp.net server control to pass in the proper parameters: you'll see that they get set as InitParams on the silverlight plugin, and eventually FileUploaderControl.InitializeFromInitParams is called.  In a pure-silverlight scenario, you can just set these properties directly.  The most important are the UploadHandlerPath (path to your http handler that receives the files, which can be the exact same handler provided in the examples), and UploadedFileProcessorType: once again, you can use the provided example as-is.

3. Listen for events on the FileUploaderControl directly in silverlight.  The provided uploadercontrol.js listens for the very same events in javascript.  In particular, see:





The FileCollection is exposed as the Files property of the FileUploaderControl.


As stated above, the use of an UploadedFileProcessorType on the server to receive your files should work exactly the same no matter whether you use this control directly in silverlight, or via the provided "standalone" example that wraps it in an asp.net server control and javascript API.

Let me know if you require more guidance getting this control working in a pure silverlight app... at some point I'd like to refactor the control a bit so that it is easier to use in both scenarios ("standalone" or within a silverlight app).  My time is a bit limited at the moment, so it may be a while before I could update this project, but I'll try to respond to any questions in a timely manner.

Oct 21, 2010 at 3:58 PM


First of all, great work!! And thanks for sharing this control, its exactly what I need!

Now the question: I cant make this work directly on my Silverlight Application, I get a "NotFound" error every time.
Do you have a project example of this control implemented on a SL app?



Dec 13, 2010 at 2:27 PM


I am very thankful for this control.

I think, even if my english is horrible i can summary for others what to do for using the control in a silverlight application

Many parts are already written elsewhere by the author hilmself. It's just a summary

1. add the Vci.Fileuploader project in your VS solution

2 in the ExampleFileProcessor.cs put // before the "delete file" action if you want your test to function

3 add this project as reference in your web solution.

4 add to the web.config of the web projects lines about the handler (explained in the author's tutorial)

5 Verify that you can write in the Directeory "sandbox"

6 in your silverlight page put your control in the xaml text. I did not succeed in using VS to do it with my mouse. that's not Dramatic. ( i name it fileUploader for example)

7 in the constructor of your page write the followings

Dictionary<string, string> initParamList = new Dictionary<string, string>();          

     initParamList["UploadHandlerPath"] = "/UploaderControlHandler.ashx";
            initParamList["MaxUploads"] = "5";
            initParamList["MaxFileSizeKB"] = "20480";
            initParamList["ChunkSizeMB"] = "3";
            //if (!string.IsNullOrEmpty(FileFilter)) initParamList["FileFilter"] = FileFilter;
            initParamList["UploadedFileProcessorType"] = "Vci.FileUploader.ExampleFileProcessor,Vci.FileUploader";
            initParamList["MultiSelect"] = "False";

//Attach events if you want more

Do not ask me but default values do not work. I don't know why. Not Dramatic either.

8. Write a processor if you want one for you, else let the exampleFileProcessor for your tests (without the delete line)

9 try and enjoy.