我一直在尝试让我的应用程序将图像数据作为 base 64 发送到 .net Web 服务,该服务将其转换回图像并将其保存在服务器上。
这适用于 10px x 10px 的小图像,但对于其他任何东西,我都会从服务器收到错误的请求响应。这是我的代码。我将其作为 xml 执行,因为我也无法使 postValue 工作。
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[reqstring setString:@"<Files xmlns=\"http://schemas.datacontract.org/2004/07/FileUpload\">"];
[reqstring appendString:@"<filename>"];
[reqstring appendString:@"/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QMraHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI"];
[reqstring appendString:@"</filename></Files>"];
[request appendPostData:[reqstring dataUsingEncoding:NSUTF8StringEncoding]];
[request setValidatesSecureCertificate:NO];
[request addRequestHeader:@"Content-Type" value:@"text/xml"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestUploadFinished:)];
[request setDidFailSelector:@selector(requestUploadFailed:)];
[request startSynchronous];
以这种方式发送的内容或服务器上需要更改的内容是否有限制?
关于这种事情的任何好的教程?
任何帮助将不胜感激