views:

40

answers:

1

I am building an app that is entirely Silverlight. It is hosted on Windows Azure. How can I do file upload?

There are a number of SL file uploaders, such as this one, which don't work for me because they are stand-alone SL controls - they can't be embedded in my app.

I see a few SL file upload examples that seem straightforward enough, but do I have to do something different for Azure than a normal ASP app?

Thanks.

+1  A: 

Aside from WCF tweaks you might need to make (documented here), you need to think about where you'll be storing your file on the server. You can't just write to a local drive. Ok, you can but local storage isn't guaranteed to stick around. Instead, you'll want to consider storing your upload in an Azure blob, which is considered Durable Storage (it's backed up to multiple locations).

If you upload to an Azure blob directly from your Silverlight client, you'll need to connect with the Azure Storage API. You need to be careful about embedding your key within your Silverlight app, and the recommended guidance is to used Shared Access Signatures - see Steve Marx's post for more info about this.

You can also continue to use a WCF service, and having that service method then store your upload to a blob. This gives you the ability to keep your Silverlight app's upload logic intact, and also rely on your service tier to track access to your uploaded file.

David Makogon