imageUp.php 962 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. header("Content-Type:text/html;charset=utf-8");
  3. error_reporting( E_ERROR | E_WARNING );
  4. date_default_timezone_set("Asia/chongqing");
  5. include "Uploader.class.php";
  6. //上传配置
  7. $config = array(
  8. "savePath" => "../../../uploads/editor/" , //存储文件夹
  9. "maxSize" => 1000 , //允许的文件最大尺寸,单位KB
  10. "allowFiles" => array( ".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp" ) //允许的文件格式
  11. );
  12. //上传文件目录
  13. $Path = "../../../uploads/editor/";
  14. //背景保存在临时目录中
  15. $config[ "savePath" ] = $Path;
  16. $up = new Uploader( "upfile" , $config );
  17. $type = $_REQUEST['type'];
  18. $callback=$_GET['callback'];
  19. $info = $up->getFileInfo();
  20. /**
  21. * 返回数据
  22. */
  23. if($callback) {
  24. echo '<script>'.$callback.'('.json_encode($info).')</script>';
  25. } else {
  26. echo json_encode($info);
  27. }