-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestUploadFile.php
41 lines (32 loc) · 929 Bytes
/
testUploadFile.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
<html>
<head>
</head>
<body>
<?php
require_once("classes/ImageFile.php");
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Stored in: " . $_FILES["file"]["tmp_name"] . "<br />";
try
{
$imageFile = new ImageFile($_FILES["file"]);
$image = $imageFile->toPHPImage();
imagejpeg($image , 'simpletext.jpg');
imagedestroy($image);
echo "<img src='simpletext.jpg' />";
}
catch (Exception $e)
{
echo $e -> getMessage() + " conversion failed";
}
}
?>
</body>
</html>