Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/inc/ajax/document.ajax.php

26 lines
992 B

<?php
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls for the document upload
*/
require_once '../global.inc.php';
if (api_is_anonymous()){
exit;
}
if(!empty($_FILES)) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
$result = DocumentManager::upload_document($_FILES, $_POST['curdirpath'], '', '', 0, 'overwrite');
$file = $_FILES['file'];
$json = array();
$json['name'] = Display::url(api_htmlentities($file['name']), $result['url'], array('target'=>'_blank'));
$json['type'] = api_htmlentities($file['type']);
$json['size'] = format_file_size($file['size']);
if (!empty($result) && is_array($result)) {
$json['result'] = Display::return_icon('accept.png', get_lang('Uploaded'));
} else {
$json['result'] = Display::return_icon('exclamation.png', get_lang('Error'));
}
echo json_encode($json);
}
exit;