1
votes

I am uploading a stream of photo from my phone camera to azure. I am uploading e.ChosenPhoto which is a stream of the taken photo and i am using blob.Metadata["ImageType"] = "image/jpeg"; but still, when the photo is uploaded the content is marked as application/octet-stream and when i go to the url the browser download the photo instead of displaying it.

What steps do i need to do in order for it to make it jpg ?

EDIT: it seems that the library that comes with WAT for WP - WindowsPhoneCloud.StorageClient.dll doesn't support blob.Propeties at all. (maybe because WP only support async calls ?) Is there any workaround on setting the content type ?

2

2 Answers

4
votes

Try setting blob.Properties.ContentType = "image/jpeg".

0
votes

Unless the SAS is used, it is highly recommended that we use a cloud service to upload blobs. If we upload a blob directly from Windows Phone without SAS, we have to embed our storage account key in the Windows Phone application. If a hacker gets the key, he will obtain full control of our Windows Azure storage account. For example, he can upload several TB data to the storage, and requires us to pay for the data. So instead of trying to upload the blob from Windows Phone, please try to host a service in Windows Azure. We upload the image to our service, and our service saves the file in blob. As long as we don’t return the storage key in any response, it will be safe.

If we have to upload directly from Windows Phone without SAS, we may need to manually use the REST API for the scenario to work. According to http://watwp.codeplex.com/discussions/352111 , the WAT library doesn’t allow us to specify a content type. In addition, I would like to point out that WAT is just a toolkit. It is not a built-in Windows Azure component.

Best Regards,

Ming Xu.