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