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');
$foldername = $_REQUEST['foldername'];
if(!$l21auth->isWorkgroupUser($id, $sql_object)) die('no way!');
$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"}';
|