I could really, really, really use some help. I have looked everywhere on some detailed documentation (for dummies) on using ASIFormDataRequest for photo uploads. Can some
I faced similar problem, i re-sized the image using
UIImage *im = [info objectForKey:@"UIImagePickerControllerOriginalImage"] ;
UIGraphicsBeginImageContext(CGSizeMake(320,480));
[im drawInRect:CGRectMake(0, 0,320,480)];
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData* imageData=UIImageJPEGRepresentation(newImage, 0.5);
and it started working, the height and width of the captured image will be more than 2000x2000 so reduce it and give a try.
[request setData:imageData withFileName:@"photo.jpg" andContentType:@"image/jpeg" forKey:@"file"];
and this is the php script.
$filename="uploaded";
$target_path = "uploads/";
$target_path = $target_path .$filename.".jpg";
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "uploaded an image";
} else{
echo "There was an error uploading the file, please try again!";
}