kindeditor.php 619 B

1234567891011121314151617
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. include "../../system/db.class.php";
  4. if (!empty($_FILES)) {
  5. $filepart = pathinfo($_FILES["imgFile"]["name"]);
  6. if (in_array(strtolower($filepart["extension"]), array("jpg", "jpeg", "gif", "png"))) {
  7. $dir = SafeRequest("dir", "get");
  8. $path = "data/attachment/" . $dir . "/" . date("Y-m-d") . "/";
  9. $name = uniqid() . $_FILES["imgFile"]["name"];
  10. creatdir(IN_ROOT . $path);
  11. @move_uploaded_file($_FILES["imgFile"]["tmp_name"], IN_ROOT . $path . $name);
  12. exit(json_encode(array("error" => 0, "url" => $path . $name)));
  13. } else {
  14. echo "-1";
  15. }
  16. }