document.ajax.php 478 B

12345678910111213141516
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Responses to AJAX calls for the document upload
  5. */
  6. require_once '../global.inc.php';
  7. if (api_is_anonymous()){
  8. exit;
  9. }
  10. if(!empty($_FILES)) {
  11. require_once api_get_path(LIBRARY_PATH).'document.lib.php';
  12. DocumentManager::upload_document($_FILES, $_POST['curdirpath'], '', '', 0);
  13. $file = $_FILES['file'];
  14. echo '{"name":"'.$file['name'].'","type":"'.$file['type'].'","size":"'.$file['size'].'"}';
  15. }
  16. exit;