我已经在iphone
中做了应用程序,它消耗了coldfusion webservice.
我想在远程服务器上的iphone应用程序上显示图像。使用coldfusion webservice
我可以从远程server.so检索图像,我想通过webservice将该图像发送到iphone应用程序。那么,这可能吗?请帮me.Thanks提前可以通过Web服务发送图像吗?
回答
使用CFFILE或cfimage的读取文件。 Base64对数据进行编码,然后通过web服务发送。在iPhone应用程序的base64解码中,您将拥有图像的二进制文件。
我试过这个代码,但它不给任何输出
这应该工作得很好。 – Paul
你可以通过创建形式上传图像尝试下面的代码
-(void)UploadImage{
NSString *urlString = @"yourUrl";
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSMutableData *body = [NSMutableData data];
NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request addValue:contentType forHTTPHeaderField:@"Content-Type"];
// file
NSData *imageData = UIImageJPEGRepresentation([self scaleAndRotateImage:[selectedImageObj]],90);
[body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
// [body appendData:[[NSString stringWithString:@"Content-Disposition: attachment; name=\"user_photo\"; filename=\"photoes.jpg\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"image\"; filename=\"%@.jpg\"\r\n",@"ImageNmae"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[NSData dataWithData:imageData]];
[body appendData:[[NSString stringWithString:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
// close form
[body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
// set request body
[request setHTTPBody:body];
//return and test
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
}
我不想上传图像。我只是想显示放在远程服务器上的图像,这是通过web服务检索.SO coldfusion webservice包含图像和图像我想发送的iPhone应用程序将要显示 –
保罗是在正确的轨道上。但是,您很可能需要以不同的方式读取源文件。从我发现的过去,你需要获得文件和base64的二进制文件。所以,这个代码应该为你工作..
<cfset myFile = toBase64(fileReadBinary('path.to.image.file'))>
- 1. 通过web服务发送图像
- 2. 您可以通过Lotus Notes发送Web服务
- 3. 我可以通过服务发送短信吗?
- 4. SQL Reporting服务可以通过电子邮件发送PDF吗?
- 5. 通过web服务发送文件
- 6. 如何通过Web服务发送ArrayList?
- 7. 通过REST Web服务以base64字符串发送多个图像
- 8. 发送图像到web服务
- 9. 发送图像到web服务与jQuery
- 10. 发送图像到.NET Web服务
- 11. 通过web api发送图像返回
- 12. Skype Web SDK通过IM发送图像
- 13. 通过Web服务发送图像返回“文件过早结束”
- 14. 通过web服务传递图像
- 15. Java Web服务可以从Apache Tomcat向客户端发送通知吗?
- 16. Web服务可以将消息从服务器发送到客户端吗?
- 17. WCF服务可以像WEB API服务那样模块化吗?
- 18. 无法通过JSON发送base64字符串图像到asp.net web服务android
- 19. 图像没有通过IOS中的POST方法发送到PHP Web服务
- 20. 是否可以通过RDCOM发送可视化图像?
- 21. 通过AJAX发送图像
- 22. 通过goRPC发送图像
- 23. 通过$ http.post发送图像
- 24. 通过iphone发送图像
- 25. 我可以使用PHP通过交换服务器发送会议投影吗?
- 26. 我可以通过Iphone在后台发送位置信息给服务器吗?
- 27. Android应用通过服务器发送图像:wamp
- 28. 使用python通过TCP发送图像到c#服务器
- 29. 通过没有base64编码的Worklight服务器发送图像
- 30. 通过httpmultipart发送图像到服务器
是的,你可以参考:通过网络发送图像] [1] [1]:http://stackoverflow.com/questions/5216988 /发送-iphone-camera-captured-images-to-the-web-service-and-getting-respons –
我已经提到,但我想从webservice发送图像到iphone –