I have to send a audio file from and iOS app and store in MySQL using php. I have converted the audio file to base64string and sent to the server. The problem is I can store only few bytes of data in the database.
NSURL *aUrl = [NSURL URLWithString:@"URL"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:aUrl
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
NSString *postString = [NSString stringWithFormat:@"audiostring=%@,",audioStr];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(!connection){
NSLog(@"Connection Failed");
}
if($_POST["audiostring"])
{
$sql="insert into AudioDetails (audiostring)values('$_POST[audiostring]')";
$result=mysql_query($sql) or die(mysql_error());
}
Above are the code for iOS and php.