ajaxgetpackagesize.php 753 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class myMisc extends misc
  3. {
  4. /**
  5. * Ajax get client package size.
  6. *
  7. * @param string $type
  8. * @param string $fileName
  9. * @access public
  10. * @return void
  11. */
  12. public function ajaxGetPackageSize($type = 'client', $fileName = 'zentaoclient.zip')
  13. {
  14. $account = $this->app->user->account;
  15. $packageFile = $this->app->wwwRoot . "data/{$type}/{$account}/{$fileName}";
  16. $size = 0;
  17. if(file_exists($packageFile))
  18. {
  19. $size = filesize($packageFile);
  20. $size = $size ? round($size / 1048576, 2) : 0;
  21. }
  22. $response = array();
  23. $response['result'] = 'success';
  24. $response['size'] = $size;
  25. $this->send($response);
  26. }
  27. }