Source for file upload.php
Documentation is available at upload.php
* @author Simon Georget <simon@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
//header('Content-type: application/json');
//header('Content-type: text/plain');
include_once('../config/define.php');
include_once('../lib/lib_common.php');
include_once('../lib/functions_auth.php');
////////////////////////////////////////
include_once('../class/system/class.'. SQL. '.php');
$GLOBALS['sql_object'] = new $sql_entity;
$GLOBALS['sql_object'] -> DBInitialise();
$GLOBALS['sql_object'] -> DBConnexion();
$foldername = $_REQUEST['foldername'];
$tempFile = $_FILES['file']['tmp_name'];
$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;
echo '{"name":"'. $filename. '","type":"'. $file['type']. '","size":"'. $file['size']. '"}';
echo '{"error" : "File transfer error"}';
|