iPhone 拍摄照片并将其发布到数据库
我目前正在向我的应用程序添加一些拍照功能。
不过,我对某件事很好奇。照片拍摄后,此代码将其作为一段数据保存:
NSData *imageData = UIImagePNGRepresentation(saveImage);
我需要知道的是用户拍摄后的照片将如何获得通过 PHP 脚本发送到网络。脚本已经写好了,但是在 iPhone 端,我必须以编程方式做什么才能确保它以正确的格式发送到数据库以供查看?我有“POST”NSURL 请求设置,我已经多次使用它来发布字符串/数字,但我不知道这对于照片数据是否有所不同。
I'm currently adding some photo-taking functionality to my application.
I'm curious about something, though. After the photo is taken, this code holds it as a piece of data:
NSData *imageData = UIImagePNGRepresentation(saveImage);
What I need to know is how the picture, after taken by the user, would get sent to the web via a PHP script. The script has been written, but on the iPhone end, what would I have to do programatically to ensure it gets sent to the database in the right format for viewing? I have the "POST" NSURL request setup, which I've used many times for posting strings/numbers, but I don't know if this is different for photo data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
打开Google,搜索“cocoa upload photo iphone”,看到第一个结果:
如何将照片上传到服务器与iPhone?
Open Google, search for 'cocoa upload photo iphone', see first result:
How can I upload a photo to a server with the iPhone?