I would like to know if it is possible to create a audio recording, put the recorded file inside a directory, and transfere this file to a folder, outside the phone, via HTTP.
I built a PHP file that receives the address from the file, and saves it to a folder:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_GET['url']);
$fp = fopen('file_name.3gpp', 'w');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
?>
My Java activity to record audio:
File directory = new File(Environment.getExternalStorageDirectory()
+ File.separator + "record");
directory.mkdirs();
outputFile = Environment.getExternalStorageDirectory() + File.separator
+ "record" + "/record.3gpp";
myRecorder = new MediaRecorder();
myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myRecorder.setOutputFile(outputFile);
Now I would like to get the directory from the recorded audio, and send it using GET.
It would look like this:
http://localhost/folder/record.php?url=DIRECTORY FROM THE AUDIO
How can I do that? Thank you.