SDK |
Documentation |
Script to Generate a Unique FilenameNote this script is optional. There are also two other ways to specify the uploaded file name.The Applet uses this script first in order to get a unique filename. This prevents collisions when multiple clients are uploading files at the same time. The script must return information to the Applet in a specific format in two lines of text:
If the first line does not start with SUCCESS then the line is assumed to contain error information and is displayed to the user. Note that for testing purposes, a simple script could return a non-unique filename. Here is a PHP example: <? // Return a non-unique filename to client for testing. // Tell browser we are sending text not HTML. // These must come before anything else is printed so that // they get in the header. header("Cache-control: private"); header("Content-Type: text/plain"); echo "SUCCESS\n"; // indicate we got a valid filename echo "msg_123456.wav\n"; // the filename echo "Additional text will show up in the Java console.\n"; // for debugging ?> A script for a real application could create a database record then generate
a unique filename from the record ID. See "gen_unique_id.php" in the release
package for an example. |