Click here to Skip to main content
15,743,609 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i tried to upload image from iphone to wcf rest service but i had problem

Public Function Upload(ByVal UploadData As Stream) As String

Dim fileToupload As New FileStream("D:\ImagesUpload\" & "ImagePng", FileMode.Create)

Dim bytearray As Byte() = New Byte(9999) {}
Dim bytesRead As Integer, totalBytesRead As Integer = 0
bytesRead = UploadData.StrStream.Read(bytearray, 0, bytearray.Length)
totalBytesRead += bytesRead
Loop While bytesRead > 0
fileToupload.Write(bytearray, 0, bytearray.Length)

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [AFCompoundResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
[manager POST:@"" parameters:@{@"StrStream":[NSData dataWithData:imageData]} success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"%@",responseObject);
failure:^(AFHTTPRequestOperation *operation, NSError *error) {

NSLog(@"Error: %@", error);


Invalid type in JSON write (OS_dispatch_data)'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900