123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
- function upfile_joutput_data($datas)
- {
- $data = array();
- $data['code'] = 200;
- $data['message'] = 'SUCCESS';
- $data['datas'] = $datas;
- echo(json_encode($data));
- }
- function upfile_joutput_error()
- {
- $data = array();
- $data['code'] = 15000;
- $data['message'] = "上传文件失败.";
- $data['datas'] = null;
- echo(json_encode($data));
- }
- if ($_POST)
- {
- $base_path = BASE_ROOT_PATH . '/data/upload/uploadtmp';
- $ret = array();
- if(isset($_POST["file_path"]) && isset($_POST["file_sha1"]) && isset($_POST["file_name"])) {
- $file_path = $_POST["file_path"];
- $file_path = str_replace($base_path, '', $file_path);
- $ret['file_path'] = $file_path;
- $ret['file_sha1'] = $_POST["file_sha1"];
- $ret['src_name'] = $_POST["file_name"];
- upfile_joutput_data($ret);
- } else {
- upfile_joutput_error();
- }
- }
- ?>
|