修改上传

This commit is contained in:
JaguarJack 2020-06-28 08:34:19 +08:00
parent 1c9e98ff2a
commit cc5805f410

View File

@ -61,7 +61,8 @@ class CatchUpload
$path = Filesystem::disk($this->getDriver())->putFile($this->getPath(), $file); $path = Filesystem::disk($this->getDriver())->putFile($this->getPath(), $file);
if ($path) { if ($path) {
$url = self::getCloudDomain($this->getDriver()) . $path;
$url = self::getCloudDomain($this->getDriver()) . '/' . $this->getLocalPath($path);
event('attachment', [ event('attachment', [
'path' => $path, 'path' => $path,
@ -76,6 +77,15 @@ class CatchUpload
throw new FailedException('Upload Failed, Try Again!'); throw new FailedException('Upload Failed, Try Again!');
} }
protected function getLocalPath($path)
{
if ($this->getDriver() === self::LOCAL) {
return str_replace(root_path('public'), '', \config('filesystem.disks.local.root')) . DIRECTORY_SEPARATOR .$path;
}
return $path;
}
/** /**
* 多文件上传 * 多文件上传
* *