<?php
define('IN_PHPUP',1);
define('ROOT_PATH',dirname(dirname(__FILE__)));
$root=str_replace('editor/upload.php','',$_SERVER['PHP_SELF']);

$uploaddir='data/upload/'.date('Y').'/'.date('m');

if($_FILES)
{
	include "../inc/global.func.php";
	$file=_upload('file1','../'.$uploaddir);
	if($file)
	{
		$file=str_replace('//','/',$root.'/'.$uploaddir.'/'.basename($file));
		if($_POST['type']=='attach')
			{
				die("<script language='javascript'>window.parent.LoadAttach('{$file}');</script>");
			}
			else
			{
				die("<script language='javascript'>window.parent.LoadIMG('{$file}');</script>");
			}
	}
	else
	{
		die("<script language='javascript'>window.parent.document.getElementById('divProcessing').style.display='none';history.back();</script>");
	}
}
