<?php
	require("../__common__/__define_common.php");
	require("../__common__/include-common-all.php");
	my_session_start();
	require("../account/__logincheck.php");
	if ($_SESSION['システム管理者'] <> "YES") {
		exit;
	}
	if (FILE_MANAGER_ID_PASSWORD_USE == 'YES') {
		if ($_SESSION['_id_mgr_logincheck'] <> "OK") {
			exit;
		}
	}
	if ($_GET['path'].'' == '') {
		exit;
	}
	$uploaddir = my_GET('path');
	$file = $uploaddir . '/' . basename($_FILES['uploadfile']['name']);
	$fileSJIS = myfile_ENCODE($file);
	$size = $_FILES['uploadfile']['size'];
			/*
				if($size>1048576) {
					echo "error file size > 1 MB";
					unlink($_FILES['uploadfile']['tmp_name']);
					exit;
				}
			*/
	if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $fileSJIS)) {
		echo "success"; 
	} else {
		echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)";
	}
?>