<?php


$dia = date("d-m-y-[h-i-s]"); 
$ip_usuario = $_GET['info'].".png";
//unlink('QWERTY/images/'.$ip_usuario);


	if(isset($_FILES['image'])){
		$errors= array();
		$file_name = $ip_usuario;
		$file_size =$_FILES['image']['size'];
		$file_tmp =$_FILES['image']['tmp_name'];
		$file_type=$_FILES['image']['type'];   
		
		@$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
		
		@$expensions= array("jpeg","jpg","png"); 		
		if(in_array($file_ext,$expensions)=== false){
			$errors[]="extension not allowed, please choose a JPEG or PNG file.";
		}
		if($file_size > 2097152){
		@$errors[]='File size must be excately 2 MB';
		}				
		if(empty($errors)==true){
			$file2 = $file_name;
			@move_uploaded_file($file_tmp,"QWERTY/images/".$file_name);
			echo "<center><img src='QWERTY/images/load2.php?img=".$_GET['info'].".png' height=50 width=50>";

		}else{
			//print_r($errors);
		}
	}
?>

<html>

<head>
<meta name="viewport" content="width=device-width, user-scalable=-1;">
<script language='javascript'>
function validate() {
var sl = document.getElementById("arquivo");
if (sl.value.length < 6)
    {
        //sl.focus();
        alert("Arquivo inválido!");
        return false;
    }
    else {
    document.form1.submit();
    }
}
</script>
<style type="text/css">
.style1 {
	text-align: center;
}
</style>
</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="background-color: #333333">

<form name="form1" action="" method="post" enctype="multipart/form-data">
<div class="style1">
<br>
<br>
<input type="file" name="image" id="arquivo" style="width: 100%; height: 42px;border:0px;background-color:transparent;font-size:medium;color:silver">
</div>
<center>
<input type="button" value="ENVIAR QRCODE" onclick="return validate();" id="layer4"></center>
</div>
</div>
</form>

</body>

</html>
