Memory issue while uploading multiple images to server - ios

I am uploading multiple images to server using ASIHTTPRequest.
-(void)uploadImagesToServer
{
[[self networkQueue] cancelAllOperations];
// Creating a new queue each time we use it means we don't have to worry about clearing delegates or resetting progress tracking
[self setNetworkQueue:[ASINetworkQueue queue]];
[[self networkQueue] setDelegate:self];
[[self networkQueue] setRequestDidStartSelector:#selector(uploadRequestStarted:)];
[[self networkQueue] setRequestDidFinishSelector:#selector(requestFinished:)];
[[self networkQueue] setRequestDidFailSelector:#selector(requestFailed:)];
[[self networkQueue] setQueueDidFinishSelector:#selector(queueFinished:)];
[[self networkQueue] setUploadProgressDelegate:self.uploadBar];
[[self networkQueue] setShowAccurateProgress:YES];
[ASIHTTPRequest setDefaultTimeOutSeconds:30];
for (int i = 0; i< appDelegate.selImageDetails.count; i++) {
NSMutableDictionary *dic = [appDelegate.selImageDetails objectAtIndex:i];
NSString *orderid = [[NSUserDefaults standardUserDefaults] objectForKey:#"orderId"];
if ([[dic objectForKey:#"Status"] isEqualToString:#"N"] || [[dic objectForKey:#"Status"] isEqualToString:#"Failed"])
{
NSURL *url = [NSURL URLWithString:#"http://180.151.100.53:9776/App_Frame_IT/UploadImage"];
NSLog(#"UPLOAD IMAGE ARRAY == %#",dic);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request addPostValue:orderid forKey:#"OrderId"];
[request addPostValue:[dic objectForKey:#"ImageName"] forKey:#"imgName"];
[request addPostValue:#"10" forKey:#"appId"];
[request addPostValue:[dic objectForKey:#"Frame"] forKey:#"frameSize"];
[request addPostValue:[dic objectForKey:#"Quantity"] forKey:#"Quantity"];
NSString *imgCount = [NSString stringWithFormat:#"%d", [appDelegate.selImageDetails count]];
[request addPostValue:imgCount forKey:#"totalimages"];
[request addPostValue:[dic objectForKey:#"paperQuality"] forKey:#"paper_quality"];
NSURL *assetURL = [dic objectForKey:#"assetPathURL"];
ALAssetsLibrary *assetLibrary=[[ALAssetsLibrary alloc] init];
[assetLibrary assetForURL:assetURL resultBlock:^(ALAsset *asset) {
ALAssetRepresentation *rep = [asset defaultRepresentation];
Byte *buffer = (Byte*)malloc(rep.size);
NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:rep.size error:nil];
NSData *data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];//this is NSData may be what you want
//NSLog(#"returned Image ====> %#", data);
// UIImageView *testImageView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 10, 50, 50)];
NSLog(#"FUll REsolution Image Size in MB = %.2f",(float)data.length/1024.0f/1024.0f);
//[data writeToFile:photoFile atomically:YES];//you can save image later
//NSData *imageData = [[NSData alloc] initWithContentsOfMappedFile:[dic objectForKey:#"Path"]];
[request addData:data withFileName:[dic objectForKey:#"ImageName"] andContentType:#"image/png" forKey:#"uploadfile"];
//[data release];
NSLog(#"requestGenrated table count---%d ",[appDelegate.selImageDetails count]);
NSString *requestUserName = [NSString stringWithFormat:#"upload%i",i];
[request setUsername:requestUserName];
[request setUserInfo:[NSDictionary dictionaryWithObject:[dic objectForKey:#"unique"] forKey:#"uniqueId"]];
[request setTag:i];
[request setShowAccurateProgress:YES];
[request setRequestMethod:#"POST"];
[request setShouldContinueWhenAppEntersBackground:YES];
[[self networkQueue] addOperation:request];
[dic setObject:#"Y" forKey:#"requestGenrated"];
[appDelegate.selImageDetails replaceObjectAtIndex:i withObject:dic];
NSLog(#"Upload Request Created");
} failureBlock:^(NSError *err) {
NSLog(#"Error: %#",[err localizedDescription]);
}];
[pool drain];
}
else
{
NSLog(#"((Image already uploaded))");
}
}
failedRequests = 0;
[networkQueue setShouldCancelAllRequestsOnFailure:YES];
[[self networkQueue] go];
}
I am getting these images from ALAssetsLibrary as you can see above in the code. I am able to upload all the images successfully but the problem is that, it is consuming too much memory (see screenshot)
I am not able to release this memory even after uploading all the images or moving to different view. What am I suppose to do, which object do I've to release?
Thanks

Set up the cachePolicy of NSURLRequest to avoid cache, should be similar in ASIFormDataRequest
request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData

Related

IOS - Memory Management - Recursive call to NSURLConnection causes Memory Usage to Increase

I have a function that gets called recursively to get new data from the database depending on the latest date. My problem is that this recursive call made causes memory usage to increase. I have commented out code to see what line is cause 300kb to be Allocated every time, so whats happening is that every time the NSURLConnection is hit i get memory usage to be increased by 300kb every 10 seconds.
This is the method that gets called recursively:
-(NSString*)setupPhpCall:(NSString*)requestString :(NSString*)sciptPage{
#autoreleasepool {
//NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:0];
//[NSURLCache setSharedURLCache:sharedCache];
NSHTTPURLResponse *urlresponse = nil;
NSError *error = nil;
NSString *response = #"";
NSData *myRequestData = nil;
NSMutableURLRequest *request = nil;
NSData *returnData = nil;
myRequestData = [NSData dataWithBytes: [requestString UTF8String] length: [requestString length]];
//Create your request string with parameter name as defined in PHP file
request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: [NSString stringWithFormat: #"http://www.hugt.co.uk/%#", sciptPage]]];
// set Request Type
[request setHTTPMethod: #"POST"];
// Set content-type
[request setValue:#"application/x-www-form-urlencoded" forHTTPHeaderField:#"content-type"];
// Set Request Body
[request setHTTPBody: myRequestData];
// Now send a request and get Response
//NSHTTPURLResponse* urlResponse = nil;
//NSError *error = nil;
//if(tmpArray.count == 0){
returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlresponse error: &error]; //THIS LINE CAUSES THE MEMORY USAGE TO INCREASE
response = [[NSString alloc] initWithBytes:[returnData bytes] length:[returnData length] encoding:NSUTF8StringEncoding];
//}
// Log Response
urlresponse = nil;
error = nil;
myRequestData = nil;
request = nil;
returnData = nil;
//NSLog(#"%#",response);/****/
//[sharedCache removeAllCachedResponses];
if(response != nil){
return response;
}
}
return nil;
}
This is what i do with the response:
-(void)recurseForumActivity{
#autoreleasepool {
__block __weak dispatch_queue_t concurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(concurrentQueue, ^{
myRequestStringForum = [NSString stringWithFormat:#"lastDate=%#&threadTitle=%#&threadCountry=%#&threadCategory=%#&threadSubCategory=%#&getData=0",lastDateForumActivity,searchThreadTitle, searchThreadCountry, searchThreadCategory, searchThreadSubCategory];
responseForum = [self setupPhpCall:myRequestStringForum :#"xxx.php"];
[NSThread sleepForTimeInterval:2.0f];
dispatch_async(dispatch_get_main_queue(), ^{
if(responseForum.length > 0 && ![responseForum isEqualToString:#"[]"]){
labelNewForumThreads.text = [NSString stringWithFormat:#"%# new threads...", responseForum];
if(imageviewForumAlert == NULL){
UIImage *image = [UIImage imageNamed:#"alert.png"];
imageviewForumAlert = [UIImageView new];
[viewNav1 addSubview:imageviewForumAlert];
imageviewForumAlert.translatesAutoresizingMaskIntoConstraints = NO;
imageviewForumAlert.image = image;
NSDictionary *viewsDictionary = #{#"imageviewForumAlert":imageviewForumAlert};
NSArray *constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:#"V:|-19-[imageviewForumAlert(12)]-19-|"
options:0
metrics:nil
views:viewsDictionary];
NSArray *constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:#"H:|-19-[imageviewForumAlert(12)]-19-|"
options:0
metrics:nil
views:viewsDictionary];
[self.view addConstraints:constraint_H];
[self.view addConstraints:constraint_V];
}else{
imageviewForumAlert.hidden = NO;
}
/**NSDictionary *dic = [response JSONValue];
if((NSNull*)dic != [NSNull null]){
labelNewForumThreads.text = [NSString stringWithFormat:#"%d new threads...", dic.count];
}**/
}else{
imageviewForumAlert.hidden = YES;
labelNewForumThreads.text = [NSString stringWithFormat:#"%d new threads...", 0];
}
/**else{
labelNewForumThreads.text = [NSString stringWithFormat:#"%d new threads...", 0];
}**/
myRequestStringForum = #"";
responseForum = #"";
concurrentQueue = nil;
[self recurseForumActivity];
});
});
}
}

Wait the function run finish only get the data [duplicate]

This question already has an answer here:
Storing values in completionHandlers - Swift
(1 answer)
Closed 7 years ago.
I have a function that get data from server and it will run asynchronous while other function is running.
my problem, i called the function [self getdata] at viewdidload(). and NSLog at below the called function but the data is delay. it get null. may i know anyway to wait the function run finish only print out the data for me?
-(void)getdata
{
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *userID = [prefs objectForKey:#"userID"];
//get merged news
float latitude = [[prefs objectForKey:LAST_KNOWN_LATITUDE] floatValue];
float longitude = [[prefs objectForKey:LAST_KNOWN_LONGITUDE] floatValue];
NSInteger ref_id =[[[eventDict objectForKey:#"id"] substringFromIndex:2]integerValue];
NSInteger reference_EventType = [[eventDict objectForKey:#"type_id"]integerValue];
NSString *type =#"EVENT";
NSString *str = [NSString stringWithFormat:#"%#event.php", API_URL];
NSURL *URL = [NSURL URLWithString:str];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:URL];
__unsafe_unretained ASIFormDataRequest *_request = request;
[request setRequestMethod:#"POST"];
[request setPostValue:#"get_event_notification" forKey:#"tag"];
[request setPostValue:[NSNumber numberWithInteger:ref_id] forKey:#"reference_id"];
[request setPostValue:[NSNumber numberWithInteger:reference_EventType] forKey:#"reference_eventType"];
[request setPostValue:type forKey:#"reference_type"];
[request setPostValue:[NSNumber numberWithFloat:latitude] forKey:#"latitude"];
[request setPostValue:[NSNumber numberWithFloat:longitude] forKey:#"longitude"];
[request setPostValue:userID forKey:#"user_id"];
[request setDelegate:self];
[request setTimeOutSeconds:30.0];
[request setShouldAttemptPersistentConnection:NO];
[request startAsynchronous];
[request setCompletionBlock:^(void){
NSInteger responseCode = [_request responseStatusCode];
if (responseCode == 200 || responseCode == 201 || responseCode == 202)
{
//NSLog(#"%#", [_request responseString]);
NSMutableDictionary *response = (NSMutableDictionary *)[[_request responseString] JSONValue];
NSInteger success = [[response objectForKey:#"success"] integerValue];
if (success == 1)
{
if ([[response objectForKey:#"event"] isKindOfClass:[NSArray class]]) {
event = [[response objectForKey:#"event"] objectAtIndex:0];
dataArray=[event objectForKey:#"merged"];
NSLog(#"dataArray %d",dataArray.count);
mergedCount=[NSString stringWithFormat:#"%d",dataArray.count];
NSArray *pathsMergedCount = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryMergedCount = [pathsMergedCount objectAtIndex:0];
NSString *filePathMergedCount= [documentsDirectoryMergedCount stringByAppendingPathComponent:#"fileMergedCount.txt"];
[mergedCount writeToFile:filePathMergedCount atomically:TRUE encoding:NSUTF8StringEncoding error:NULL];
for(i=0;i<[dataArray count];i++)
{
feedDict=[dataArray objectAtIndex:i];
[eventIDMerged addObject:[feedDict objectForKey:#"event_id"]];
[eventDescMerged addObject:[feedDict objectForKey:#"description"]];
}
}}}
}];
[request setFailedBlock:^(void){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Connection Failed" message:#"Internet connection too slow, please ensure you have a strong internet connection to have better user experience" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alert show];
}];
}
-(void)viewDidLoad
{
[self getdata];
dispatch_async(dispatch_get_main_queue(), ^{
NSArray *pathsMergedCount = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryMergedCount = [pathsMergedCount objectAtIndex:0];
NSString *filePathMergedCount= [documentsDirectoryMergedCount stringByAppendingPathComponent:#"fileMergedCount.txt"];
NSString *strMergedCount = [NSString stringWithContentsOfFile:filePathMergedCount encoding:NSUTF8StringEncoding error:NULL];
NSLog(#"Count3m %#",strMergedCount);
});
});
}
See my answer in this thread:
Storing values in completionHandlers - Swift
It includes a link to a full project (in Swift) demonstrating using completion handlers to manage async tasks.

Uploading NSData image via POST in iOS

i have a form that contains some person information and an image. i tried to save information in post using this function and it work well :
- (void)Inscription:(NSArray *)value completion:(void (^)( NSString * retour))block{
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
NSArray *Param_header = #[#"username", #"password", #"email",#"first_name", #"last_name",#"image"];
// NSArray *Param_value = #[#"ali", #"aliiiiiiii", #"ali.ali#gmail.com",#"ali",#"zzzzz"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString: [NSString stringWithFormat:#"http:// /Messenger/services/messenger_register"]]];
NSString *aa=[self buildParameterWithPostType:#"User" andParameterHeaders:Param_header ansParameterValues:value];
[request setHTTPBody:[aa dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPMethod:#"POST"];
[NSURLConnection sendAsynchronousRequest: request
queue: queue
completionHandler: ^(NSURLResponse *response, NSData *data, NSError *error) {
if (error || !data) {
// Handle the error
NSLog(#"Server Error : %#", error);
} else {
NSError *error = Nil;
id jsonObjects = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
block([NSString stringWithFormat:#"%#", [jsonObjects objectForKey:#"message"]]);
}
}
];
}
No, i want to send the photo taked, i convert it to NSData first :
[picker dismissViewControllerAnimated:YES completion:nil];
UIImage *imag= [info objectForKey:#"UIImagePickerControllerOriginalImage"];
imag = [imag scaleAndRotateImage:imag];
CGFloat compression = 0.9f;
CGFloat maxCompression = 0.1f;
int maxFileSize = 25*1024;//was 250x1024
NSData *imageData = UIImageJPEGRepresentation(imag, compression);
while ([imageData length] > maxFileSize && compression > maxCompression)
{
compression -= 0.1;
imageData = UIImageJPEGRepresentation(imag, compression);
}
NSData _D_ImageData = imageData;
And i tried to do this to send it to server but image c'ant be uploaded:
[web Inscription:Param_value completion:^(NSString *retour) {
CustomPrpgress.hidden=true;
NSLog(#" eee %# ",retour);
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:retour message:#"" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles: nil];
[alert show];
}];
Can someone help me, i'm beginner and this is my first time. thank you
My code work fine, i made a mistake in the php file

ASINetworkQueue some image download fails

I am downloading a bunch of images via ASINetworkQueue. I have no problems in the simulator, but on the iPad some of the images (each time they are different) are not downloaded. How can I fix this?
Here is the code:
Queue Creation:
if (addedPaintings > 0) {
[currentPaintingsArray addObjectsFromArray:objectsToAdd];
[unseenPaintings addObjectsFromArray:objectsToAdd];
[self downloadImages];
}
// update plist file if data was altered.
if (addedPaintings > 0 || removedPaintings > 0)
[currentPaintingsArray writeToFile:dataFilePath atomically:YES];
else
[self completeSync:request.responseStatusCode];
}
Image Download method:
- (void) downloadImages {
[networkQueue reset];
[networkQueue setDelegate:self];
[networkQueue setShowAccurateProgress:YES];
[networkQueue setDownloadProgressDelegate:self.progressView.customView];
[networkQueue setQueueDidFinishSelector:#selector(imageQueueDownloadComplete:)];
for (NSDictionary *dict in [Globals sharedGlobals].unseenPaintings) {
NSString *link = [dict objectForKey:#"link"];
NSString *smallLink = [dict objectForKey:#"smallLink"];
if ([link length] != 0) {
NSURL *url = [NSURL URLWithString:[[URL stringByAppendingString:GALLERY] stringByAppendingString: link]];
ASIHTTPRequest *downloadRequest = [[ASIHTTPRequest alloc] initWithURL:url];
[downloadRequest setDownloadDestinationPath:[documentsDirectory stringByAppendingPathComponent:link]];
[downloadRequest setDidFailSelector:#selector(imageDownloadFailed:)];
[downloadRequest setDidFinishSelector:#selector(imageDownloadComplete:)];
[downloadRequest setUserInfo:dict];
[downloadRequest setDelegate:self];
[networkQueue addOperation:downloadRequest];
[downloadRequest release];
NSURL *urlCarousel = [NSURL URLWithString:[[URL stringByAppendingString:WS_IMAGES] stringByAppendingString: smallLink]];
downloadRequest = [[ASIHTTPRequest alloc] initWithURL:urlCarousel];
[downloadRequest setDownloadDestinationPath:[documentsDirectory stringByAppendingPathComponent:smallLink]];
[downloadRequest setDidFailSelector:#selector(imageDownloadFailed:)];
[downloadRequest setUserInfo:dict];
[downloadRequest setDelegate:self];
[networkQueue addOperation:downloadRequest];
[downloadRequest release];
}
}
[networkQueue go];
}
Based on the comments you've left to the question, (Specifically: Also, if I change the download method from networkQueue to [downloadRequest startAsynchronous], everything works.) it may be that your request is timing out when being run synchronously.
Another thing you should know is that the "ASI network classes" are no longer being maintained. The developer offers several alternatives in his blog post announcing the end-of-life of that software.

ios ASIFormDataRequest reporting invalid file from PHP upload

Somebody please... #$%^ please take a look at this. days walking through the debugger, using setData with a jpeg representation. set file using ios4 asset library, trying a new PHP script, deleting the asiHTTPrequest files and making damn sure I have the new ones. Still nothing... Half the code has been put together from examples here or elsewhere on the web.
The goal here, is to simply pick a photo from the camera roll, and upload it, seems pretty easy, I had a different PHP script that was working fine from the desktop and nabbed one from here because it's much more concise and it works from the desktop as well.
so the override for finishing image picking
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
UIImage *originalImage, *editedImage, *imageToSave;
// dealing with a still image
if(CFStringCompare((CFStringRef) mediaType, kUTTypeImage, 0) == kCFCompareEqualTo){
editedImage = (UIImage *) [info objectForKey:UIImagePickerControllerEditedImage];
originalImage = (UIImage*) [info objectForKey:UIImagePickerControllerOriginalImage];
/*
if(editedImage){
imageToSave = editedImage;
} else {
imageToSave = originalImage;
}
*/
chosenImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
//_imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation(originalImage, 0.0)];
//_imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation(chosenImage.image, 0.0)];
UIImage *im = [info objectForKey:#"UIImagePickerControllerOriginalImage"] ;
UIGraphicsBeginImageContext(CGSizeMake(320,480));
[im drawInRect:CGRectMake(0, 0,320,480)];
_resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
_imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation(_resizedImage, 0.0)];
}
[picker release];
}
then the upload method.
-(void)uploadPhoto
{
//NSLog(#"image path inside uploadPhoto --> %#", _imagePath);
NSLog(#"uploadPhoto");
//NSLog(#"%#", imageData);
//_imageData = _imageData;
NSString *unescapedURL = #"http://dev.xxxx.com/upload.php";
NSString * escapedURL =
(NSString *)CFURLCreateStringByAddingPercentEscapes(
NULL,
(CFStringRef)unescapedURL,
NULL,
(CFStringRef)#"!*'();:#&=+$,/?%#[]",
kCFStringEncodingUTF8 );
NSURL *url = [NSURL URLWithString:unescapedURL];
//NSURL *url = [NSURL URLWithString:unescapedURL];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setRequestMethod:#"POST"];
//[request setStringEncoding:NSUTF8StringEncoding];
//[request addPostValue:#"submit" forKey:#"Submit"];
//[request setPostValue:#"Submit" forKey:#"Submit"];
[request setData:_imageData withFileName:#"image4.jpg" andContentType:#"image/jpeg" forKey:#"photo"];
//[request setFile:_imagePath forKey:#"photo"];
//[request setFile:_imagePath withFileName:#"image5.png" andContentType:#"image/png" forKey:#"photo"];
[request setDidFailSelector:#selector(requestFailed:)];
[request setDidFinishSelector:#selector(requestFinished:)];
[request setTimeOutSeconds:500];
[request startAsynchronous];
NSError *error = nil;
NSString *theString = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error];
if( theString )
{
NSLog(#"Text=%#", theString);
}
else
{
NSLog(#"Error = %#", error);
NSString *localized = [error localizedDescription];
NSString *localizedFail = [error localizedFailureReason] ? [error localizedFailureReason] : NSLocalizedString(#"not it", nil);
NSLog(#"localized error--> %#", localized);
NSLog(#"localizedFail--> %#", localizedFail);
}
[escapedURL release];
}
then the finish/fail selectors
-(void)requestFinished:(ASIFormDataRequest *)request
{
NSLog(#"requestFinished");
NSString *respondingString = [request responseString];
NSLog(#"response string--> %#", respondingString);
NSData *responseData = [request responseData];
NSLog(#"%#", responseData);
}
-(void)requestFailed:(ASIFormDataRequest *)request
{
NSLog(#"requestFailed");
//NSError *error = [request error];
//NSLog(#"%#", [error description]);
}
Help! Drowning...
It was a problem with the PHP.
move_uploaded_file($_FILES["file"]["tmp_name"]
was the issue.
if you look at this
[request setData:_imageData withFileName:#"image4.jpg" andContentType:#"image/jpeg" forKey:#"photo"];
It's changing the POST so the standard...
move_uploaded_file($_FILES["file"]["tmp_name"]
needs to be
move_uploaded_file($_FILES["photo"]["tmp_name"]
adding
error_reporting(E_ALL);
ini_set("display_errors", 1);
print_r($_FILES);
to the PHP allowed me to see..
response string--> Array
(
[photo] => Array
(
[name] => image4.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpCSXJgl
[error] => 0
[size] => 150854
)
)
in the selector defined by...
[request setDidFinishSelector:#selector(requestFinished:)];
What I'll do from here is revert the PHP to where it was before
move_uploaded_file($_FILES["file"]["tmp_name"]
and change the setFile call to
[request setData:_imageData withFileName:#"image4.jpg" andContentType:#"image/jpeg" forKey:#"file"];
all will be well with the world and I'm going to get some food. cheers!

Resources