-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfile_upload.php
68 lines (63 loc) · 1.75 KB
/
file_upload.php
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo @$_FILES["file"]["name"]; ?></title>
</head>
<body>
<?php
require_once("ophir.php");
if (!isset($_FILES["file"])) {
?>
<form action="file_upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<p>Configuration:<br>
<table cellspacing=0 cellpadding=0 border=1>
<tr><th>Element</th><th>Import</th><th>Import as text</th><th>Remove</th></tr>
<?php
foreach ($_ophir_odt_import_conf["features"] as $conf=>$value){
echo '<tr><td>'.$conf.'</td>';
echo '<td><input type="radio" name="features['.$conf.']" value="2" checked></td>';
echo '<td><input type="radio" name="features['.$conf.']" value="1" /></td>';
echo '<td><input type="radio" name="features['.$conf.']" value="0" /></td>';
echo '</tr>';
}
?>
</table>
</p>
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
<?php
}else{
if (($_FILES["file"]["size"] < 1e6))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$_ophir_odt_import_conf["features"] = array_map('intval', $_POST["features"]);
$time = microtime(true);
echo odt2html($_FILES["file"]["tmp_name"]);
echo '<div style="background-color:grey">';
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
echo "\n\n<br><font size='0.5em'>HTML generated in <b>".(microtime(true)-$time)."</b> microseconds</font>";
echo "</div>";
}
}
else
{
echo "Invalid file";
}
}
?>
</body>
</html>