+ Reply to Thread
Results 1 to 2 of 2

Thread: Create a WCF REST service to receive image

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    3

    Create a WCF REST service to receive image

    How to create a WCF REST service to receive image?

  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    6
    You need Stream type param to receive image as a Stream. Your OperationContract should have a signature like this:

    Code:
    		[OperationContract]
                    [WebInvoke(Method = "POST", UriTemplate = "uploadimage")]
                    string UploadImage(Stream stream);
    Then you can implement it like this:

    Code:
    		string UploadImage(Stream stream)
    		{
    		 string imagePath = "C:\img.jpg";
    		 Image image = Image.FromStream(stream);
                     image.Save(imagePath);
    		}

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts