Dashboard sipadu mbip
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ajax_upload_file.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. include('../../../php/class.uploader.php');
  3. $uploader = new Uploader();
  4. $data = $uploader->upload($_FILES['files'], array(
  5. 'limit' => 10, //Maximum Limit of files. {null, Number}
  6. 'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)}
  7. 'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))}
  8. 'required' => false, //Minimum one file is required for upload {Boolean}
  9. 'uploadDir' => '../../../uploads/', //Upload directory {String}
  10. 'title' => array('name'), //New file name {null, String, Array} *please read documentation in README.md
  11. 'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)}
  12. 'replace' => false, //Replace the file if it already exists {Boolean}
  13. 'perms' => null, //Uploaded file permisions {null, Number}
  14. 'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback
  15. 'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback
  16. 'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback
  17. 'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback
  18. 'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback
  19. 'onRemove' => null //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback
  20. ));
  21. if($data['isComplete']){
  22. $files = $data['data'];
  23. echo json_encode($files['metas'][0]['name']);
  24. }
  25. if($data['hasErrors']){
  26. $errors = $data['errors'];
  27. echo json_encode($errors);
  28. }
  29. exit;
  30. ?>