<?php
session_start();
require_once('../config/config.php');
require_once(CLASS_DIR.'dbClass.php');
if($_FILES['image']['name']!=''){
	$file_size =$_FILES['image']['size'];
	$file_tmp =$_FILES['image']['tmp_name'];
	$file_type=$_FILES['image']['type'];
	$file_name= time().$_FILES['image']['name'];
	$desired_dir='uploads/statusimg';
	$extention = end(explode(".", $file_name));
	$newfilename = time().".".$extention;
	//echo "<br>".basename($file_name);
	move_uploaded_file($file_tmp,$desired_dir."/".$newfilename);
	mysql_query("INSERT INTO `mychat`(`userid`, `msg`, `datetime`) VALUES ('".$_SESSION['userid']."','images-$newfilename','".date("Y-m-d H:i:s")."')");
}

?>

<form action="" method="post" id="userstatus" enctype="multipart/form-data" style="float: left;margin-bottom: 0px;">
	<input id="file" type="file" name="image" style="width: 0px;height:0PX; margin-top: 14px;cursor: pointer;float: left;opacity: 0;">
	<div onclick="uploadFile();" style="cursor: pointer;background-image: url(camera.png);width: 33px;height: 30px;float: left;"></div>
	<input type="submit" name="submit" value="Upload" class="classname">
</form>
<script>
function uploadFile(){
	document.getElementById("file").click();
}
</script>
<style>
body {
margin: 0px;
}
</style>
<style type="text/css">
.classname {
	-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
	-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
	box-shadow:inset 0px 1px 0px 0px #ffffff;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
	background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
	background-color:#ededed;
	-webkit-border-top-left-radius:6px;
	-moz-border-radius-topleft:6px;
	border-top-left-radius:6px;
	-webkit-border-top-right-radius:6px;
	-moz-border-radius-topright:6px;
	border-top-right-radius:6px;
	-webkit-border-bottom-right-radius:6px;
	-moz-border-radius-bottomright:6px;
	border-bottom-right-radius:6px;
	-webkit-border-bottom-left-radius:6px;
	-moz-border-radius-bottomleft:6px;
	border-bottom-left-radius:6px;
	text-indent:0;
	border:1px solid #dcdcdc;
	display:inline-block;
	color:#777777;
	font-family:arial;
	font-size:12px;
	font-style:normal;
	height:30px;
	line-height:27px;
	outline: none;
	width:80px;
	text-decoration:none;
	text-align:center;
	text-shadow:1px 1px 0px #ffffff;
}
.classname:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );
	background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
	background-color:#dfdfdf;
}.classname:active {
	position:relative;
	top:1px;
}</style>