SilverlightShow: Uploading multiple files with Silverlight Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: Uploading multiple files with Silverlight <p class="authorNameHolder" style="margin-top: 0px; margin-right: auto; margin-bottom: auto; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; float: left; color: #323232; font-family: 'segoe ui', helvetica, arial, verdana, tahoma, sans-serif; font-size: 11px; line-height: 16px; background-color: #f8f8f8;">Thank you a lot <a id="ctl00_cphMiddle_cphContent_modules_articles_article_ascx1_hlnkAuthor" class="authorName" href="http://www.silverlightshow.net/Profile/AndreaBoschin.aspx" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; color: #006699; text-decoration: none; font-size: 13px; font-family: 'palatino linotype', 'book antiqua', palatino, serif; line-height: 17px;">Andrea Boschin</a>. Great arcticle.</p> <p class="authorNameHolder" style="margin-top: 0px; margin-right: auto; margin-bottom: auto; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; float: left; color: #323232; font-family: 'segoe ui', helvetica, arial, verdana, tahoma, sans-serif; font-size: 11px; line-height: 16px; background-color: #f8f8f8;"></p> <p class="authorNameHolder" style="margin-top: 0px; margin-right: auto; margin-bottom: auto; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; float: left; color: #323232; font-family: 'segoe ui', helvetica, arial, verdana, tahoma, sans-serif; font-size: 11px; line-height: 16px; background-color: #f8f8f8;"></p> <div class="joined" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 13px; font-style: italic; color: #666666; font-family: 'palatino linotype', 'book antiqua', palatino, serif;"><br /> </div>   <p>I´m using IIS 7.5 and I´ve found the same problem of CK.</p> <p>I had to enable the upload handler to work on IIS7.5 . I enabled the "PUT" action on IIS Handlers</p> <p>The folowing code inside the web.config worked to me : </p> <p><span class="Apple-tab-span" style="white-space: pre;"> </span><system.webServer></p> <p><span class="Apple-tab-span" style="white-space: pre;"> </span><validation validateIntegratedModeConfiguration="false" /><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span><directoryBrowse enabled="true" /><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span><handlers><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span><remove name="SimpleHandlerFactory-Integrated-4.0" /><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span><add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span></handlers><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span></system.webServer></p> <p><span style="font-family: 'segoe ui', helvetica, arial, verdana, tahoma, sans-serif; color: #aaaaaa; font-size: 12px; line-height: 20px; white-space: nowrap;"><br /> </span></p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment7659 FelipeEsteves http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Mon, 12 Mar 2012 16:25:30 GMT Re: Uploading multiple files with Silverlight <p>Oh no I get it, they're custom controls. False Alarm.</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment6340 tayzirov http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 15 Jul 2011 09:08:53 GMT Re: Uploading multiple files with Silverlight <p>hi<br /> when I open up the solution and try to open up the xaml files, I immediately get the following errors:<br /> <br /> Warning<span class="Apple-tab-span" style="white-space: pre;"> </span>1<span class="Apple-tab-span" style="white-space: pre;"> </span>Could not load file or assembly 'file:///C:\Users\AWESOME-02\Downloads\SilverlightPlayground.MultiFileUpload\SilverlightPlayground.Controls\Bin\Debug\SilverlightPlayground.Controls.dll' or one of its dependencies. The system cannot find the file specified.<span class="Apple-tab-span" style="white-space: pre;"> </span>SilverlightPlayground.MultiFileUpload.Silverlight<br /> <br /> </p> <p>Error<span class="Apple-tab-span" style="white-space: pre;"> </span>2<span class="Apple-tab-span" style="white-space: pre;"> </span>Unable to load the metadata for assembly 'SilverlightPlayground.Controls'. This assembly may have been downloaded from the web.  See http://go.microsoft.com/fwlink/?LinkId=179545.  The following error was encountered during load: Could not load file or assembly 'SilverlightPlayground.Controls, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.<span class="Apple-tab-span" style="white-space: pre;"> </span>C:\Users\AWESOME-02\Downloads\SilverlightPlayground.MultiFileUpload\SilverlightPlayground.MultiFileUpload.Silverlight\MainPage.xaml<span class="Apple-tab-span" style="white-space: pre;"> </span>1<span class="Apple-tab-span" style="white-space: pre;"> </span>1<span class="Apple-tab-span" style="white-space: pre;"> </span>SilverlightPlayground.MultiFileUpload.Silverlight<br /> <br /> </p> <p>Error<span class="Apple-tab-span" style="white-space: pre;"> </span>3<span class="Apple-tab-span" style="white-space: pre;"> </span>The type 'slpgcontrols:MultipleFileUpload' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.<span class="Apple-tab-span" style="white-space: pre;"> </span>C:\Users\AWESOME-02\Downloads\SilverlightPlayground.MultiFileUpload\SilverlightPlayground.MultiFileUpload.Silverlight\MainPage.xaml<span class="Apple-tab-span" style="white-space: pre;"> </span>9<span class="Apple-tab-span" style="white-space: pre;"> </span>10<span class="Apple-tab-span" style="white-space: pre;"> </span>SilverlightPlayground.MultiFileUpload.Silverlight</p> <div><br /> </div> Is Silverlight Playground some kind of toolkit? I've never heard of it before. http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment6332 tayzirov http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Wed, 13 Jul 2011 01:45:01 GMT RE: Uploading multiple files with Silverlight <p class="commentText">Thank <span id="ctl00_cphMiddle_ContentPlaceHolderContent_itemComments_dlstComments_ctl40_lblCommentAuthor">Andrea Boschin</span> very much.</p> <p class="commentText">I believe this will help a lot of people.</p> <p class="commentText">But i face a problem here and hope you able to help me.</p> <p class="commentText">I am new in silverlight.<br /> <br /> Eveything work OK when i run from solution SilverlightPlayground.MultiFileUpload.sln.</p> <p class="commentText">After I copy the whole folder SilverlightPlayground.MultiFileUpload to C:\ with 3 Sub folder inside.</p> <div class="commentText"> <ol> <li>SilverlightPlayground.Controls</li> <li>SilverlightPlayground.MultiFileUpload.Silverlight</li> <li>SilverlightPlayground.MultiFileUpload.Web</li> </ol> </div> <p>From IIS, i create a virtual directory point to the folder C:\SilverlightPlayground.MultiFileUpload with Alias name MultipleUpload.</p> <p>here i attach the print screen of my local IIS so that you are more clearer on this. <a href="http://www.flickr.com/photos/47392278@N05/5535972357/">http://www.flickr.com/photos/47392278@N05/5535972357/</a></p> <p>The URL to run demo.html page is <a href="http://localhost/MULTIPLE/SilverlightPlayground.MultiFileUpload.Web/demo.html">http://localhost/MULTIPLE/SilverlightPlayground.MultiFileUpload.Web/demo.html</a>.</p> <p>should i change the <span style="font-family: consolas; color: #ff0000; font-size: 13px;">UploadHandlerUri</span> from the MainPage.xaml to....?</p> <ol> <li><span style="color: #1ca0f2;"><a href="http://localhost/MULTIPLE/SilverlightPlayground.MultiFileUpload.Web/upload.ashx">http://localhost/MULTIPLE/SilverlightPlayground.MultiFileUpload.Web/upload.ashx</a></span></li> <li><span style="font-family: consolas; color: #0000ff; font-size: 13px;"><span style="font-family: consolas; color: #0000ff; font-size: 13px;"><span style="font-family: consolas; color: #0000ff; font-size: 13px;"> <p> </p> </span> <p> </p> </span> <p> </p> </span> <p><span style="color: #1ca0f2;">http://localhost/MULTIPLE/upload.ashx</span><br /> or or other correct Uri?<br /> <br /> I face the error message below:<br /> <br /> {System.Security.SecurityException ---> System.Security.SecurityException: Security error.<br />    bij System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)<br />    bij System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)<br />    bij System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)<br />    --- Einde van intern uitzonderingsstackpad ---<br />    bij System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)<br />    bij System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)<br />    bij SilverlightPlayground.Controls.UploadManager.<>c__DisplayClass9.<DoPutUpload>b__6(IAsyncResult r)<br />    bij System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)<br />    bij System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)<br />    bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<br />    bij System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()<br />    bij System.Threading.ThreadPoolWorkQueue.Dispatch()<br />    bij System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}</p> </li> </ol> <p>Please assit on me, thank you.</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment5725 CK http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 18 Mar 2011 05:40:05 GMT RE: Uploading multiple files with Silverlight 4.0 hi Kamil, what kind of help do you need? http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4892 Andrea Boschin http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Thu, 18 Nov 2010 09:57:44 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Hi everyone,</p> <p>I'm  new in silverlight and i need a fileupload project to improve myself ,but the above example is really hard to understand , can anyone help me? </p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4875 Kamil http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Wed, 17 Nov 2010 04:36:36 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Did any one had some problem with this solution running on IIS 7.5 ?</p> <p></p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4596 Pablo Lima http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 01 Oct 2010 00:35:48 GMT RE: Uploading multiple files with Silverlight 4.0 <div>Just blogged about this, its a really cool control.</div> <div><br /> </div> <a href="http://blogs.3sixtysystems.com/NMH/post/Discovered-a-really-cool-multiple-file-uploader.aspx">http://blogs.3sixtysystems.com/NMH/post/Discovered-a-really-cool-multiple-file-uploader.aspx</a> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4393 NMH http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 03 Sep 2010 13:39:58 GMT RE: Uploading multiple files with Silverlight 4.0 thanks, good catch! http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4337 Andrea Boschin http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Thu, 26 Aug 2010 14:45:43 GMT RE: Uploading multiple files with Silverlight 4.0 <p>very cool code.</p> <p>Your code is very optimized, a lot of new technology.</p> <p>I changed your source a little as below because of Korean character.</p> <p>In Silverlight: rq.Headers["File-Name"] = HttpUtility.UrlEncode(file.File.Name);</p> <p>In ASP.Net: string filename = HttpUtility.UrlDecode(context.Request.Headers["File-Name"]);</p> <p>Thanks a lot!</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4336 doctorgu http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Thu, 26 Aug 2010 14:22:33 GMT RE: Uploading multiple files with Silverlight 4.0 I also want to add that my library uploads directly to Amazon S3, not using a file handler so it doesn't lock any process at the host server level.     http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4204 Dustin Horne http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Tue, 10 Aug 2010 18:55:45 GMT RE: Uploading multiple files with Silverlight 4.0 <p>hyspdrt -</p> <p>Are you talking to me?  You're looking at the author of this article's source code, not mine.  :P  Run my sample application and look at the traffic via Wireshark.  It's a single connection that streams the data and offers notification via an event model and property change notification to give you upload status.  It also allows cancellation of the upload.</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4203 Dustin Horne http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Tue, 10 Aug 2010 18:53:43 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Actually, after reviewing your source code, it appears you do make a connection for each chunk...</p> <span style="font-family: consolas; font-size: 13px;"><span style="font-family: consolas; font-size: 13px;"> <p>From your UploadChunk(<span style="font-family: consolas; color: #2b91af; font-size: 13px;">UploadFile</span><span style="font-family: consolas; font-size: 13px;"> file</span>) method:</p> </span> <p> </p> </span> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">HttpWebRequest</span><span style="font-family: consolas; font-size: 13px;"> rq = (</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">HttpWebRequest</span><span style="font-family: consolas; font-size: 13px;">)</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">WebRequestCreator</span><span style="font-family: consolas; font-size: 13px;">.ClientHttp.Create(</span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">this</span><span style="font-family: consolas; font-size: 13px;">.UploadHandlerUri);</span></p> <p><span style="font-family: consolas; font-size: 13px;">Why is you believe it's a single connection?  <p> </p> </span></p> <p> </p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4198 hyspdrt http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Mon, 09 Aug 2010 14:52:33 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Thanks for the follow up. I think our solutions are very comparable in how they creatively deal with threading on the client, but I wanted to support more abstraction between the infrastructure (the guts of the tool) and what the end developer needs to implement. Including a clear distinction of cancelling an upload and positive confirmation back to the client app, in addition to providing retry and hashing capability to an indivdual chunk. So I've segmented out the communication protocol and then allow the developer to implement a base class so they can simply provide there storage logic (database, file, etc.). I like your solution as well, and serves the purpose. And is probably more flexible for those that want to change the code directly. HSS Interlink is more of a component library, with the only coding requirement is to implenent one or more File Handler(s).</p> <p>Example, this is all that is required by the developer to implement their upload storage logic...</p> <p>public override bool CheckFileExists()<br /> public override Responses CreateNewFile()<br /> public override Responses AppendToFile(byte[] buffer) // called for each chunk<br /> public override void CancelUpload()<br /> public override void UploadComplete()<br /> public override bool IsAuthorized() // called for each request</p> <p>UploadComplete provides the opportunity to delete any temp files you may create, and IsAuthorized allows for validation of each request. With this protocol it does make connection after connection, but it provides for more server side throughput, in that each chunk from 100's of users could run concurrently versus locking a single server side request connection/process for a period of time for a single file.</p> <p>Look here for a demo of HSS Interlink @ <a href="http://hssinterlink.com/">http://hssinterlink.com/</a> </p> <p>For more details see <a href="http://interlink.codeplex.com/">http://interlink.codeplex.com/</a></p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4197 hyspdrt http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Mon, 09 Aug 2010 14:35:38 GMT RE: Uploading multiple files with Silverlight 4.0 <p>hyspdrt -</p> <p>That only applies in somescenarios, in many cases it will work just fine.  To illustrate my example, I have an upload component that uploads directly to Amazon's S3 service.  The upload is still 'chunked' in that it writes set buffers to the response stream, however it does so with a single connection which removes the overhead of making connection after connection after connection.  My example doesn't automatically cancel if your credentials are incorrect, but I do have the facilities to cancel the upload and it was very simple to implement, just by checking for a cancellation request before each buffer is written.  </p> <p>Ignore the "Load From Stream" button in my example, but you can load a file and upload.  This will work as long as you have a properly constructed and public readable clientaccesspolicy.xml file in your Amazon bucket that allows at a minimum the domain my example is served from:</p> <p><a href="http://www.parentelement.com/sls3test.html">http://www.parentelement.com/sls3test.html</a></p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4016 Dustin Horne http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Tue, 20 Jul 2010 19:30:38 GMT RE: Uploading multiple files with Silverlight 4.0 <p>When i deploy this online it doesn't seem to work. the only setting i heva changed is the <span style="font-family: consolas; color: #ff0000; font-size: 13px;">UploadHandlerUri </span>in the mainpage. Then i uploaded everything. When testing on my local pc it gives the security error. Does somebody have a clue ?</p> <p>{System.Security.SecurityException ---> System.Security.SecurityException: Security error.<br />    bij System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)<br />    bij System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)<br />    bij System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)<br />    --- Einde van intern uitzonderingsstackpad ---<br />    bij System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)<br />    bij System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)<br />    bij SilverlightPlayground.Controls.UploadManager.<>c__DisplayClass9.<DoPutUpload>b__6(IAsyncResult r)<br />    bij System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)<br />    bij System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)<br />    bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<br />    bij System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()<br />    bij System.Threading.ThreadPoolWorkQueue.Dispatch()<br />    bij System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4004 Angelo http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Sun, 18 Jul 2010 18:14:03 GMT RE: Uploading multiple files with Silverlight 4.0 that's strange, Have you run VS2010 with Administrator priviledges? If it is so please run it normally. http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment4000 Andrea Boschin http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Sat, 17 Jul 2010 00:56:28 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Failed to assign to property 'System.Windows.UIElement.AllowDrop'. [Line: 8 Position: 60]</p> <p>That's the error I get. No one else got it? Can anyone help? Pretty please? :)</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3999 Toni http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 16 Jul 2010 22:10:40 GMT RE: Uploading multiple files with Silverlight 4.0 Regarding AllowWriteStreamBuffering, there are a couple of gotchas with that as documented here (<a href="http://support.microsoft.com/kb/908573">http://support.microsoft.com/kb/908573</a>). Also, if you don't do chunking how do you handle canceling the request mid-stream, clean up on the server and time outs on large files? I have created a full control suite that handles all of this and is free on codeplex (interlink.codeplex.com) but uses chunking. It's fairly robust and support extra feature such as hashing/validation, cancel, retry and file overwriting. It's fairly simply to integrate and use. http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3965 hyspdrt http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 09 Jul 2010 13:32:09 GMT RE: Uploading multiple files with Silverlight 4.0 Just wanted to make a correction to my post from yesterday...I stated IObservable for the property, but I meant "INotifyPropertyChanged". http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3956 Dustin Horne http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Thu, 08 Jul 2010 23:03:18 GMT RE: Uploading multiple files with Silverlight 4.0 <p>The author missed one important thing.  Between the RC and the RTM I had the pleasure of having an email exchange with part of the Silverlight development team.  One of my biggest complaints was that even using the Silverlight networking stack instead of the browser, there was no good way to track upload progress (as noted above).  The key important feature that was missing was the ability to disable write stream buffering for the uploads and I thought this was key for Silverlight to be competitve for line of business apps.</p> <p>Between the RC and the RTM, the dev team implemented the feature.  If you use the HttpWebRequest object and Silverlight's networking stack you can set AllowWriteStreamBuffering to false and there is no longer a need to "chunk" the file prior to uploading to the server.  To demonstrate this, I created a Silverlight class library that uploads files directly to Amazon's S3 service without the need for a proxy server.  The library constructs a form POST and uploads the file and related data.</p> <p>The same can be used for any HttpWebRequest call.  Even if you're uploading to a page on your own server that process the file, you can disable write stream buffering and accurately track the progress of the upload.  My test class fires an event whenever a packet is sent to the stream, but a better method would be to implement IObservable on a readonly property that exposes the number of bytes uploaded (and have another property that exposes the total number of bytes for the current request).  By simply updating the bytes sent property when each set of bytes (buffer) in your loop is pushed to the server, anything bound to that property (such as the text of a label or position of a progress bar with some calculation) could accurately display the progress, making it a far more simple task since the file won't have to be manually reconstructed on the server side across multiple requests, but rather just pulled from the stream in one go.</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3943 Dustin Horne http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Wed, 07 Jul 2010 18:16:10 GMT RE: Uploading multiple files with Silverlight 4.0 That worked thanks.  I think I may have changed it because of a conflict. http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3919 Donald http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Mon, 05 Jul 2010 16:10:40 GMT RE: Uploading multiple files with Silverlight 4.0 <p>Please check you have set the right uri in the MainPage.xaml markup code.</p> <p>let me know if this solve your issue. Thanks</p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3906 Andrea Boschin http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Sat, 03 Jul 2010 03:08:18 GMT Securit Error <p>I get the following error:</p> <p>System.Security.SecurityException was unhandled by user code<br />   Message=""<br />   StackTrace:<br />        at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)<br />        at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)<br />        at SilverlightPlayground.Controls.UploadManager.<>c__DisplayClass9.<DoPutUpload>b__6(IAsyncResult r)<br />        at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)<br />        at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)<br />        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<br />        at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()<br />        at System.Threading.ThreadPoolWorkQueue.Dispatch()<br />        at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()<br />   InnerException: System.Security.SecurityException<br />        Message=Security error.<br />        StackTrace:<br />             at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)<br />             at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)<br />             at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)<br />        InnerException: <br /> <a href="http://www.wired.com/gadgetlab/2010/07/microsoft-instaload-insert-batteries-any-way-you-like/"></a></p> http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3905 Donald http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Sat, 03 Jul 2010 02:29:57 GMT RE: Uploading multiple files with Silverlight 4.0 It's really a creative file upload method, amazing ...... I love it. Thanks. http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx#comment3903 nicholaspei http://www.silverlightshow.net/items/Uploading-multiple-files-with-Silverlight-4.0.aspx Fri, 02 Jul 2010 19:11:36 GMT