views:

17

answers:

0

Following the Saving Snapshots to PNG in Silverlight 4 and the WebCam sample code, I have a silverlight app that I can place on my html form to capture an image from a web cam.

I would now like to include the image in a html form post to my MVC controller/action. At this stange in the project I'm restricted from moving the whole data entry form into the silverlight app. I need to harvest the byte array of the captured png file from the silverlight, and submit it along with the rest of the html form data.

How do I get the byte array of my png file from the silverlight to the form for posting?

Update: The Silverlight component now exposes a string property to the containing HTML, as a ScriptableMember.

On form post the submit button gets this string value and addes it to a hidden field, and which is then sent to the form. The server side then converts this base64 string back to a byte array for saving in the database.

This seems to be working fine, but I wonder if it's the best way?