PHP Classes

File: mid2rttl.php

Recommend this page to a friend!
  Classes of Fluxus   MIDI Class   mid2rttl.php   Download  
File: mid2rttl.php
Role: Example script
Content type: text/plain
Description: demonstrates binary MIDI file to RTTL ringtone conversion
Class: MIDI Class
Read, write and manipulate MIDI files and data
Author: By
Last change: description changed
Date: 18 years ago
Size: 1,575 bytes


Class file image Download

if (isset(
$mime_type = 'application/octetstream'; // force download
header('Content-Type: '.$mime_type);
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: attachment; filename="rttl.txt"');
header('Pragma: no-cache');
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
body {font-family:Verdana;font-size:11px;margin:5px;}
input {font-family:Verdana;font-size:11px}

<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="post" onsubmit="if (this.mid_upload.value==''){return true;alert('Please choose a mid-file to upload!');return false}">
<input type="hidden" name="MAX_FILE_SIZE" value="1048576"><!-- 1 MB -->
MIDI file (*.mid) to upload: <input type="file" name="mid_upload"> <input type="submit" value=" send ">

if ($file!=''){
$fn = $_FILES['mid_upload']['name'];
$bn = strtok($fn, '.');
$midi = new Rttl();
RTTL converted from: <?=$fn?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<textarea name="rttl" style="width:90%" rows="4"><?=$midi->getRttl($bn)?></textarea><br>
<input type="submit" name="save" value="save">