We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
配置文件: config/UEditorUpload.php 'mode'=>'cdn',//上传方式,local 为本地 qiniu 为七牛 cdn 为自定义位置
'mode'=>'cdn',//上传方式,local 为本地 qiniu 为七牛 cdn 为自定义位置
具体实现文件: vendor/stevenyangecho/laravel-u-editor/src/Uploader/UploadFile.php `<?php namespace Stevenyangecho\UEditor\Uploader;
use Stevenyangecho\UEditor\Uploader\Upload;
/** * *
Class UploadFile
文件/图像普通上传
@Package Stevenyangecho\UEditor\Uploader */ class UploadFile extends Upload { use UploadQiniu;
public function doUpload() {
$file = $this->request->file($this->fileField); if (empty($file)) { $this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND"); return false; } if (!$file->isValid()) { $this->stateInfo = $this->getStateInfo($file->getError()); return false; } $this->file = $file; $this->oriName = $this->file->getClientOriginalName(); $this->fileSize = $this->file->getSize(); $this->fileType = $this->getFileExt(); $this->fullName = $this->getFullName(); $this->filePath = $this->getFilePath(); $this->fileName = basename($this->filePath); //检查文件大小是否超出限制 if (!$this->checkSize()) { $this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED"); return false; } //检查是否不允许的文件格式 if (!$this->checkType()) { $this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED"); return false; } if (config('UEditorUpload.core.mode') == 'local') { try { $this->file->move(dirname($this->filePath), $this->fileName); $this->stateInfo = $this->stateMap[0]; } catch (FileException $exception) { $this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT"); return false; } } else if (config('UEditorUpload.core.mode') == 'cdn') { $data = \App\Library\Tools\Upload::curlFile($file, 'img'); info(__METHOD__ . json_encode($data, JSON_UNESCAPED_UNICODE)); if ($data['code'] == 0) { $this->stateInfo = $this->getStateInfo("ERROR_UNKNOWN"); return false; } //目前只是重置了fullName $this->fullName = $data['img'] ?? $this->getFullName(); $this->stateInfo = $this->stateMap[0]; //需要重置这些属性
// "state" => $this->stateInfo, // "url" => $this->fullName, // "title" => $this->fileName, // "original" => $this->oriName, // "type" => $this->fileType, // "size" => $this->fileSize
} else if (config('UEditorUpload.core.mode') == 'qiniu') { $content = file_get_contents($this->file->getPathname()); return $this->uploadQiniu($this->filePath, $content); } else { $this->stateInfo = $this->getStateInfo("ERROR_UNKNOWN_MODE"); return false; } return true; }
} `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
配置文件: config/UEditorUpload.php
'mode'=>'cdn',//上传方式,local 为本地 qiniu 为七牛 cdn 为自定义位置
具体实现文件: vendor/stevenyangecho/laravel-u-editor/src/Uploader/UploadFile.php
`<?php namespace Stevenyangecho\UEditor\Uploader;
use Stevenyangecho\UEditor\Uploader\Upload;
/**
*
*
Class UploadFile
文件/图像普通上传
@Package Stevenyangecho\UEditor\Uploader
*/
class UploadFile extends Upload
{
use UploadQiniu;
public function doUpload()
{
// "state" => $this->stateInfo,
// "url" => $this->fullName,
// "title" => $this->fileName,
// "original" => $this->oriName,
// "type" => $this->fileType,
// "size" => $this->fileSize
}
`
The text was updated successfully, but these errors were encountered: