* @version $id SVN * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //header('Content-type: application/json'); //header('Content-type: text/plain'); session_start(); @set_time_limit(0); include_once('../config/define.php'); include_once('../lib/lib_common.php'); include_once('../lib/functions_auth.php'); //////////////////////////////////////// /// Connexion SQL /////////////////// include_once('../class/system/class.'.SQL.'.php'); $sql_entity=SQL; $GLOBALS['sql_object'] = new $sql_entity; $GLOBALS['sql_object'] -> DBInitialise(); $GLOBALS['sql_object'] -> DBConnexion(); /////////////////// $foldername = $_REQUEST['foldername']; $id = $_REQUEST['id']; $file = $_FILES['file']; if(!isWorkgroupUser($id)) die('no way!'); if (!empty($_FILES)) { $tempFile = $_FILES['file']['tmp_name']; $file = $_FILES['file']; $filename_parts = pathinfo($_FILES['file']['name']); $filename = cleanString($filename_parts['filename']).'.'.$filename_parts['extension']; $targetPath = dirname(__FILE__). DIRECTORY_SEPARATOR . 'userfiles'. DIRECTORY_SEPARATOR . 'workgroups' . DIRECTORY_SEPARATOR . $foldername . DIRECTORY_SEPARATOR; $targetFile = str_replace('//','/',$targetPath) . $filename; if (in_array(strtolower($filename_parts['extension']),explode(',', MEDIA_ALLOWED_EXT))) { if(!file_exists(str_replace('//','/',$targetPath))) mkdir(str_replace('//','/',$targetPath), 0755, true); move_uploaded_file($tempFile,$targetFile); echo '{"name":"'.$filename.'","type":"'.$file['type'].'","size":"'.$file['size'].'"}'; } else { echo '{"error" : "File transfer error"}'; } } ?>