在我的应用程序中,我正在拍照并在图像视图中显示它。
现在我需要该图像的路径,以便将其上传到服务器。
我怎样才能得到那条路?我尝试导入 ALAsset 框架,但没有称为我的 x 代码 (4.2) iOS 5.0 的框架
NSData *data = UIImagePNGRepresentation(imagePic.image);
NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:@"upload.jpg"];
[data writeToFile:file atomically:YES];
[[EPUploader alloc] initWithURL:[NSURL URLWithString:@"myWebSite"]
filePath:@"file"
delegate:self
doneSelector:@selector(onUploadDone:)
errorSelector:@selector(onUploadError:)];
这是我目前正在尝试的。
另外,iphone相机胶卷中照片的硬编码路径是什么?“iphone/图片/myPic” ?? 所以我可以尝试上传与查找路径分开。
谢谢,麻烦您了
编辑:
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
image2 = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
// Save image
UIImageWriteToSavedPhotosAlbum(image2, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
imagePic.image = image2;
[picker release];
}