<?php
/* to use this class you
most specify the folder, img/tmp/ and img/upload/
*/
include("uploadImage.Class.php");
if(isset($_POST['btn1']) and $_POST['btn1']=="Send1") {
// Sample to use -- Upload only a image type
$nome=$_FILES['file']['name'];
$tmp_nome=$_FILES['file']['tmp_name'];
$tamanho=$_FILES['file']['size'];
$tipo=$_FILES['file']['type'];
$erro=isset($_FILES['file']['erro']);
$file=new uploadImage($nome,$tmp_nome,$tamanho,$tipo,$erro);
$file->setExtension("jpeg");
$file->setExtension("gif");
$file->setExtension("png");
$file->setExtension("jpg");
$file->setDestinationImage("img/tmp/","img/upload/");
$file->setMaxHeight(801);
$file->setMaxWidth(601);
$file->setMaxSize(200);
$file->newNameFile();
if($file->moveImage()){
echo "Upload ok: <a href='img/upload/".$file->getName()."'>".$file->getName()."</a> <br>";
echo "<input type='image' name='image' id='image' src=img/upload/".$file->getName().">";
}else{
echo " --- errro ---- ";
}
}
?>
<html>
<head>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form1">
Upload image file only:
<input type="file" name="file" id="file">
<input type="submit" name="btn1" id="btn1" value="Send1">
</form>
<p>
</p>
</body>
</html>
|