<?php
if (isset($_POST['submit']))
{
if (($_FILES['file']['type'] == 'image/png') || ($_FILES['file']['type'] == 'image/jpg') ||
($_FILES['file']['type'] == 'image/jpeg') || ($_FILES['file']['type'] == 'image/gif') ||
($_FILES['file']['size'] < 2000))
{
if ($_FILES["file"]["error"] > 0)
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
else
{
$type = str_replace('image/','',$_FILES["file"]["type"]);
$f = fopen('upload/count.txt', 'r');
if ($size > 0)
$i = fread($f,$size) + 1;
else
$i=0;
$f = fopen('upload/count.txt','w+');
$imgName = $i.'.'.$type;
$result = "<a href='makeText.php?name=$i&type=$type'>Visualizzare l'immagine:</a>";
}
}
else
$result = "File Non Valido";
}
?>
<html>
<head>
<title>Image2Text</head>
</head>
<body style="background: black; color: red;">
<div style="margin: 0 auto; width: 200px; height: 200px; ">
<form action="" method="post" enctype="multipart/form-data" style="position: absolute; margin: 0 auto; top: 200px; border:1px solid white;">
<input type="file" name="file" id="file" value="ciao" style="width: 150px; border-style:none;"/><br />
<span style="font-family: Calibri; font-size: 12px">Dimensione MAX 2mg. <br />Estensioni accettate: .png | .jpeg | .jpg | .gif</span>
<br />
<br />
<input type="submit" name="submit" value="Carica e genera il testo" style="position: absolute;left: 34px;border-style: none; margin: 0 auto" />
<br />
<span style="color: white"><? echo $result ?></span>
</form>
</div>
</body>
</html>