<?php error_reporting(0); ?><!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="upload.js" type="text/javascript"></script>
<style type="text/css">
body{
margin:0;
padding:0;
background-color:red;
}

input[type="file"]{
height:300px;
border:0;
width:300px;
cursor:pointer;
}
</style>
<script type="text/javascript">
upload_type = '<?php echo $_GET['type']; ?>';
upload_error = '<?php echo urldecode($_GET['e']); ?>';
ctime = '<?php echo time(); ?>';
xdata = '<?php echo $_GET['xdata']; ?>';
uid = '<?php echo $_GET['uid']; ?>';
userid = '<?php echo $_GET['userid']; ?>';
$(document).ready(function(){
if(upload_type=="userpic"){
if(upload_error==''){
xhtml = "Please select a <b>jpg</b> file of 30 X 30 pixels by clicking the button below. We will notify you as soon as upload is complete.";
} else if(upload_error=='profilepic_uploaded'){
xhtml = 'Upload finished : Profile picture changed successfully. You may close this notification.';
parent.userchat_avatar_updated(ctime);
} else {
xhtml = upload_error;
}
parent.userchat_upload_status('Select File', xhtml);

$('body').on('change','#userchat-upload', function(){
parent.userchat_upload_status('Please wait', 'Please wait while we upload the file. you will be notified once its done.');
document.forms['upload'].submit();
});
}



if(upload_type=="file"){
if(upload_error==''){
xhtml = "Please select any supported file that is not larger than <b>2 Mb</b> by clicking the button below. We will notify you as soon as upload is complete.<br /><br />Supported files : <b>aac, ai, aiff, avi, bmp, dmg, css, doc, dotx, dwg, dxf, eps, flv, gif, html, ics, iso, jpg, js, key, less, mid, mp3, mp4, mpg, odf, ods, odt, odp, ots, ott, pdf, png, ppt, psd, qt, rar, rb, rtf, sass, scss, sql, tga, tgz, tiff, txt, wave, xls, xlsx, xml, yml, zip.</b>";
} else if(upload_error=='file_uploaded'){
xhtml = 'Upload finished successfully. Please wait, sending message...';
parent.userchat_file_uploaded(xdata, uid);
} else {
xhtml = upload_error;
}
parent.userchat_upload_status('Select File', xhtml);

$('body').on('change','#userchat-upload', function(){
parent.userchat_upload_status('Please wait', 'Please wait while we upload the file. you will be notified once its done.');
document.forms['upload'].submit();
});
}

});
</script>
<title>userchat demo page</title>
</head>
<body>
<form name="upload" action="userchat_uploaded.php?type=<?php echo $_GET['type'].'&uid='.$_GET['uid'].'&userid='.$_GET['userid']; ?>" enctype="multipart/form-data" method="post">
<input type="file" name="userchat-upload" id="userchat-upload" />
</form>
</body>
</html>