iphone - Getting System.InvalidOperationException: Request format is invalid: multipart/form-data error while upload image(data) via AFNetworking -


i following tutorial upload image (data) via afnetworking. have done

 nsurl *url = [nsurl urlwithstring:@"http://184.154.0.24"]; afhttpclient *httpclient = [[afhttpclient alloc] initwithbaseurl:url];  //    nsmutabledictionary* _params = [[nsmutabledictionary alloc] init]; //    [_params setobject:multimdata forkey:@"bytes"]; //    [_params setobject:name forkey:@"userid"]; //    [_params setobject:@"hello" forkey:@"filename"]; //    [_params setobject:@"png" forkey:@"contenttype"];  //    [httpclient registerhttpoperationclass:[afjsonrequestoperation class]];  nsmutableurlrequest *request = [httpclient multipartformrequestwithmethod:@"post" path:@"/iphonevideoservice/webservice.asmx/getstringdata" parameters:nil constructingbodywithblock: ^(id <afmultipartformdata>formdata) {     [formdata appendpartwithfiledata:multimdata name:@"stringreturn" filename:@"stringreturn.png" mimetype:@"image/png"]; }];  afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request];  [operation setuploadprogressblock:^(nsuinteger byteswritten, long long totalbyteswritten, long long totalbytesexpectedtowrite) {     nslog(@"sent %lld of %lld bytes", totalbyteswritten, totalbytesexpectedtowrite); }];   [operation setcompletionblock:^{     nslog(@"%@", operation.responsestring); //lets know result including failures }];  //    nsoperationqueue *queue = [[nsoperationqueue alloc] init] ; //    [queue addoperation:operation];  [httpclient enqueuehttprequestoperation:operation]; 

after compiling have got error

2013-04-09 13:22:49.153 softo chat[582:19d03] sent 323584 of 333526 bytes 2013-04-09 13:22:49.153 softo chat[582:19d03] sent 327680 of 333526 bytes 2013-04-09 13:22:49.153 softo chat[582:19d03] sent 331776 of 333526 bytes 2013-04-09 13:22:49.154 softo chat[582:19d03] sent 333526 of 333526 bytes 2013-04-09 13:22:49.154 softo chat[582:1ad0b] system.invalidoperationexception: request    format invalid: multipart/form-data; boundary=boundary+0xabcdefgboundary. @ system.web.services.protocols.httpserverprotocol.readparameters() @ system.web.services.protocols.webservicehandler.coreprocessrequest() 

and server side programming asp.net

[webmethod] public string getstringdata(string stringreturn) {     return stringreturn; } 

hi pravi jay google , got 1 question related you. need change in web.config.

<add name="scripthandlerfactory" verb="*" path="*.asmx" precondition="integratedmode" type="system.web.script.services.scripthandlerfactory, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add name="scripthandlerfactoryappservices" verb="*" path="*_appservice.axd" precondition="integratedmode" type="system.web.script.services.scripthandlerfactory, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> 

please visit this:-

'system.invalidoperationexception: request format invalid: multipart/form-data' error when posting image iphone .net webservice


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -