You might want to use ASIHTTPRequest , since it will create the body of the form message for you with much less problems, and may transfer the body of the request from disk, so you save memory when loading large images.
A quick google search of this , which seems to suggest that you should post in / upload _api.php and not in /index.php.
Something like this is likely to be a good start:
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithUrl:[NSURL URLWithString:@"http://www.imageshack.us/upload_api.php"]] autorelease]; [request setFile:@"/path/to/file" forKey:@"fileupload"]; [request setPostValue:@"yes" forKey:@"xml"]; [request setPostValue:@"blahblah" forKey:@"cookie"]; //It looks as though you probably need these too [request setPostValue:@" me@somewhere.com " forKey:@"email"]; [request setPostValue:@"blah" forKey:@"key"]; [request start]; if ([request error]) { NSLog(@"%@",[request error]); } else { NSLog([request responseString]); // The xml that got sent back }
Warning: unverified!
I used a synchronous request because you did it, but you should almost certainly use an asynchronous request (queue with ASIHTTPRequest).
pokeb source share