download an image POSTed By multipart form-data

U

Umeshnath

Hi,
I need to download an image in my WCF Service. I am getting an image from
another “aspx†page by client POSTing the page using multipart form-data.

Posting aspx page

<form id="form2"
action="http://localhost:8080/services/cardservices/card/image" method="post"
enctype="multipart/form-data">
<input type="file" id="Text1" />
<!-- <input type="text" id="Text2" name="shippingaddress.lastname" />
<input type="submit" />
</form>


I think I supposed to get the image as a stream.
Below is my C# code

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/card/image")]
Activation TestImage(Stream stream);


public Activation TestImage(Stream stream)
{
MemoryStream ms = (MemoryStream)stream;

System.Drawing.Bitmap b =
(System.Drawing.Bitmap)Image.FromStream(ms);
b.Save(@"c:\two.bmp");
}

In my app config the base uri is http://localhost:8080/services/cardservices




Do I need to set any configuration setting to achieve this functionality?

Please help me to figure out.


Thanks in advance

Regards
Umeshnath
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top