Setting your recording filename using query strings

JustinDupree -

When Tropo posts a recording to your web server, the filename we send isn't going to be particularly useful to you. A way to have your application set a string that you can use for a name is to add it to your URL in a query string. If your desired name is "testing" then you can set your recordURL to something like: 

http://www.example.com/recording.php?name=testing

Then you would read the name out and use that to construct your filename before saving.

Putting it all together, using PHP as the sample language, you can grab "name", build a filename, and then save the file:

<?php

$target_path = $_GET['name'] . ".wav"; 

if(move_uploaded_file($_FILES['filename']['tmp_name'], $target_path)) { 
    print("$target_path [{$_FILES['filename']['size']} bytes] was saved"); 
} else { 
    print("$target_path could not be saved."); 
}

?>
Have more questions? Submit a request

0 Comments

Article is closed for comments.