I have an application that allows users to upload videos to the server and part of the process is to create a thumbnail image on the client that will be used for the video when loaded on the server. I have a writeablebitmap that I want to convert to a jpeg and upload to the server.
Is it possible to do this without saving the jpeg to the user's computer first - I do not want to require a trusted app. Is it possible to store it in isolatedstorage first and then upload it from there as if it is just another file on the user's computer?
thanks Michael
I implemented a solution that allows me to take a WriteableBitmap, convert it to a JPEG using FJCore and write it to a MemoryStream and send it to the server.
FluxJpeg.Core.Encoder.JpegEncoder encoder = new FluxJpeg.Core.Encoder.JpegEncoder(img, quality, stream);
see: Using FJCore to encode Silverlight WriteableBitmap
Then I found a great FileUploader class which I modified to upload a MemoryStream avoiding having to create a local file first.
ORIG:
public void StartUpload(FileInfo file)
MODIFIED:
public void StartUpload(Stream fileStream)
see: http://www.codeproject.com/KB/silverlight/SL4FileUploadAnd_SL4_MVVM.aspx
On the server I used the FileUpload.ashx described in the link above to accept the chunks of the stream and write them to a file on the server.
Calling the FileUpload.ashx using a HttpWebRequest, the MemoryStream is sent up in chunks until the end of the stream is reached.
As they bytes are received on the server they are written out to a file in a specified location.