How to send audio from ios and store in mysql using php? -
i have send audio file , ios app , store in mysql using php.i have converted audio file base64string , sent server.the problem can store few bytes of data in 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 audiodetails (audiostring)values('$_post[audiostring]')"; $result=mysql_query($sql) or die(mysql_error()); }
above code ios , php.pls problem in sending base64string , storing
do not store base64 string in database, decode string , create physical file in filesystem, put reference file in database.
Comments
Post a Comment