<?php
$uploaddir = '../custom/users/'.$_POST['id'];
//upload from drag and drop
$id=$_POST['id'];
$newFileName = strtotime('now').'_'.basename($_FILES['file']['name']);
$maxsize=5000000;
if( is_dir($uploaddir) === false )
{
  mkdir($uploaddir, 0777, true);
}
$uploadfile = $uploaddir ."/".$newFileName;
if(filesize($newFileName)>$maxsize){
echo "file size is too large";
}else{
	$status = move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
	if($status)
	{
		echo "new file uploaded successfully";
	}else{ 
		die('error');
	}
}		
?>