views:

64

answers:

3

I am developing an application that stores images as Base64 strings in xml files. I also want to allow the user to crop the image before saving it to the file, preferably all in memory without having to save a temp file, and then delete it afterwards. In order to display the newly uploaded image, I need to create a HTTP handler that I can bind the asp:Image to. The only examples for doing this online require passing the .ashx an ID and then pulling the image from a DB or other data store. Is it possible to somehow pass the raw data to the .ashx in order to get back the image?

Thanks,

Mike

A: 

Assuming that you never have a server-farm, you could put the image in session state.

However, it would not be completely reliable.

The best way to do this is to use a database.

SLaks
A DB is not available on this project. My only persistence option is XML in this case.
Mike C
Are you sure? You can't even use an MDB or data-directory SQL Server?
SLaks
A: 

An image can be POST-ed to a site just like any other file, and an HttpHandler can catch the incoming data and work with it.

The trick will just be gettimngthe in-memory representartion of the file posted to the handler.

Adrian K
A: 

I ended up having to just use AJAX and temporary files in order to get this done. There did not appear to be an easy way to transfer binary data directly to the handler.

Mike C