<?php

CLASS Upload extends RasioProject
{
	protected $set;
	protected $enableCk = true;

	public function __construct($config)
	{
		$this->getConfig($config);
		$this->validation();
		$this->set();
	}

	protected function set()
	{
		$this->set->em 			= $this->em;
		return $this->set;
	}
	
	public function File()
	{
		$fileName	 = date('YmdHis').'_'.str_ireplace('%20', '_', $_SERVER['HTTP_X_FILE_NAME']);
		
		$postdata = file_get_contents("php://input");
		$fp = fopen('assets/upload/'.$fileName, "wb");
		fwrite($fp, $postdata);
		fclose($fp);
		
		echo '{"success":true, "fileName":"'.$fileName.'", "fileAsli":"'.$_SERVER['HTTP_X_FILE_NAME'].'"}';
	
		$this->layout = "null";
	}
}