I am trying to upload uiimage from my phone application to server using php. But some how it is not working. Can someone please help me with that. My Code:
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
request.delegate = self;
request.tag = 33;
[request setPostValue:[NSString stringWithFormat:@"%@.png",responseString] forKey:@"name"];
NSArray *sysPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES );
NSString *docDirectory = [sysPaths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/MyImage.png", docDirectory];
[request setFile:filePath forKey:@"photo"];
[request startAsynchronous];
[url release];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
NSLog(@"aResponse:%@",response);
}
if(move_uploaded_file($_FILES['photo']['tmp_name'],$target_path)) {
echo "The file ". basename( $_FILES['photo']['tmp_name'])." has been uploaded";
}
else {
echo "There was an error uploading the file, please try again!";
}
>
Got Following error when debugged with nszombie in a file of ASI Request
* -[CFString release]: message sent to deallocated instance 0xd1dfd80