openupfileAction.php 768 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * 会议相关
  4. * 请求地址如:http://oa.test/api.php?m=openmeet&a=test&openkey=fee5efd3a93ca5c6a85b679cde60faa2
  5. */
  6. class openupfileClassAction extends openapiAction
  7. {
  8. public function testAction() {
  9. $str = $this->postdata;
  10. return json_encode($str);
  11. }
  12. public function upfileAction()
  13. {
  14. if(!$_FILES)exit('sorry!');
  15. $upimg = c('upfile');
  16. $maxsize= (int)$this->get('maxsize', 5);
  17. $uptype = $this->get('uptype', '*');
  18. $thumbnail = $this->get('thumbnail');
  19. $upimg->initupfile($uptype, ''.UPDIR.'|'.date('Y-m').'', $maxsize);
  20. $upses = $upimg->up('file');
  21. $arr = c('down')->uploadback($upses, $thumbnail, false);
  22. $this->returnjson($arr);
  23. }
  24. }