|
@@ -84,37 +84,19 @@ class Upload extends Base
|
|
|
*/
|
|
|
public function pdfUpload()
|
|
|
{
|
|
|
- if (!($file = $this->getUploadFile()) || empty($file)) {
|
|
|
- $this->error('文件上传异常,文件可能过大或未上传!');
|
|
|
- }
|
|
|
- if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
|
|
|
- $this->error('文件上传类型受限,请在后台配置!');
|
|
|
- }
|
|
|
- if ($file->checkExt('php,sh')) {
|
|
|
- $this->error('可执行文件禁止上传到本地服务器!');
|
|
|
- }
|
|
|
+ if (!($file = $this->getUploadFile()) || empty($file)) $this->error('文件上传异常,文件可能过大或未上传!');
|
|
|
+ if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) $this->error('文件上传类型受限,请在后台配置!');
|
|
|
+ if ($file->checkExt('php,sh')) $this->error('可执行文件禁止上传到本地服务器!');
|
|
|
$file_info = $file->getInfo();
|
|
|
-
|
|
|
$ext = pathinfo($file_info['name'],PATHINFO_EXTENSION);
|
|
|
$file_name = pathinfo($file_info['name'],PATHINFO_FILENAME);
|
|
|
$new_name = $file_name.date("Y-m-d H:i:s").'.'.$ext;
|
|
|
- var_dump($_SERVER);
|
|
|
$save_path = $_SERVER['DOCUMENT_ROOT'].'/static/pdf'.$new_name;
|
|
|
- $res = move_uploaded_file($file_info['tmp_name'],$save_path);
|
|
|
- var_dump($res,$save_path);
|
|
|
+ move_uploaded_file($file_info['tmp_name'],$save_path);
|
|
|
$res = pdfCurl($save_path);
|
|
|
- var_dump($res);
|
|
|
unlink($save_path);
|
|
|
- die();
|
|
|
- $headers = [];
|
|
|
- $headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
|
|
- // $res = pdfCurl($_SERVER['DOCUMENT_ROOT'].'/dist/img/bg-1.79910aaf.png');
|
|
|
- var_dump($file->getInfo()['']);
|
|
|
- $res = pdfCurl('/tmp/phpQayTEp');
|
|
|
- //var_dump(curlPost('http://101.132.128.55:9999/v1/pdf/upload',$_FILES['file']),$_FILES);
|
|
|
- var_dump($res);
|
|
|
-
|
|
|
-
|
|
|
+ if(!empty($res) && $res['code'] == 1) $this->success('上传成功','http://gaoyixia.oss-cn-hangzhou.aliyuncs.com'.$res['data']);
|
|
|
+ $this->error('上传失败');
|
|
|
}
|
|
|
|
|
|
|