// aql.com
// Example MMS to HTTP handler
// This is a demonstration of the data processing aspects of the aql MMS to HTTP system
// Add authentication or other security features into this script to ensure that third parties cannot upload malicious content to your servers
// specify the location of the HTML file that will show the multimedia content
// there should be a trailing slash
// example : /var/www/
// please ensure that your application has permission to write to this directory
$strLocation = 'your-directory-name/';
// append lines to the index.html file in this location
$strHTMLFile = $strLocation . 'index.html';
$fp = fopen($strHTMLFile, 'a+');
fputs($fp, date('d-m-Y h:i:s') . ' : ' . stripslashes($_POST['message']) . '
' . "\n");
fclose($fp);
// handle each file in the MMS message
foreach ($_FILES as $key=>$value) {
$strSource = $_FILES[$key]['tmp_name'];
$strDestination = $strLocation . $_FILES[$key]['name'];
// mack a quick check that the files really did arrive by HTTP POST
// note : this is not suitable security for a live environment
if (move_uploaded_file($strSource, $strDestination)) {
// this file arrived by HTTP POST so add it to the HTML file
$fp = fopen($strHTMLFile, 'a+');
// add an appropriate entry based on this file's mimetype
// although this basic example only handles jpeg images and 3gpp video, other mimetypes can be handled
switch ($_FILES[$key]['type']) {
case 'image/jpeg' :
fputs($fp, '
' . "\n");
break;
case 'video/3gpp' :
fputs($fp, '3g video (download)
' . "\n");
break;
}
fclose($fp);
} else {
// this file didn't arrive by HTTP POST - possible file upload attack
exit();
}
}
$fp = fopen($strHTMLFile, 'a+');
fputs($fp, '
' . "\n");
fclose($fp);
?>