download an image POSTed By multipart form-data

Discussion in 'ASP .Net Web Services' started by Umeshnath, Aug 11, 2009.

  1. Umeshnath

    Umeshnath Guest

    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
    Umeshnath, Aug 11, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guy

    Receiving multipart posted data

    Guy, Jan 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    417
    bruce barker
    Jan 5, 2004
  2. Li Zhang
    Replies:
    4
    Views:
    6,061
    softip
    Feb 27, 2009
  3. Matt
    Replies:
    8
    Views:
    142,325
    zeeshanakhter2009
    May 26, 2012
  4. Kevin DeValck
    Replies:
    1
    Views:
    723
    7stud --
    May 17, 2011
  5. Replies:
    1
    Views:
    397
Loading...

Share This Page