forked from robbie-cao/midi-class-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmid2txt.php
More file actions
41 lines (38 loc) · 1.24 KB
/
mid2txt.php
File metadata and controls
41 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
$p = $_POST;
$tt = isset($p['tt'])?$p['tt']:0;
$file=(isset($_FILES['mid_upload'])&&$_FILES['mid_upload']['tmp_name']!='')?$_FILES['mid_upload']['tmp_name']:'';//(isset($p['file'])?$p['file']:'');
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Midi2Text</title>
<style>
body {font-family:arial;font-size:11px;margin:5px;}
input {font-family:arial;font-size:11px}
</style>
</head>
<body>
<form enctype="multipart/form-data" action="mid2txt.php" method="POST" onsubmit="if (this.mid_upload.value==''){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">
<br>
TimestampType:
<input type="radio" name="tt" value="0"<?php if ($tt==0) echo ' checked'?>> Absolute
<input type="radio" name="tt" value="1"<?php if ($tt==1) echo ' checked'?>> Delta
<br><br>
<input type="submit" value=" send ">
</form>
<?php
if ($file!=''){
require('midi.class.php');
$midi = new Midi();
$midi->importMid($file);
echo 'File: '.$_FILES['mid_upload']['name'];
echo '<hr><pre>';
echo $midi->getTxt($tt);
echo '</pre>';
}
?>
</body>
</html>