composer require hoga/lah5upload -vvvv
windows
:php artisan vendor:publish --provider=Hoga\lah5upload\lah5uploadServiceProvider
mac|linux
:php artisan vendor:publish --provider=Hoga\\lah5upload\\lah5uploadServiceProvider
Encore\Admin\Form::extend('lah5upload', \Hoga\lah5upload\lah5uploadFiled::class);
$form->lah5upload('url','视频');
可选扩展:video视频类型文件 file所有类型的文件 mp3音频文件 image图片文件
$form->lah5upload('url','视频')->setExpansion('video');
$form->lah5upload('url','视频')->setOssPath('video');
请打开网站https://help.aliyun.com/document_detail/100624.html?spm=a2c4g.11186623.2.10.316879b0jDJxFq#concept-xzh-nzk-2gb根据提升一步一步添加配置
分片上传 最后一个请求报错 One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag 错误
// 响应信息
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidPart</Code>
<Message>One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag.</Message>
<RequestId>5C455831BB4097C0D8F96794</RequestId>
<HostId>wolaile.oss-cn-hangzhou.aliyuncs.com</HostId>
<ETag>undefined</ETag>
<PartNumber>1</PartNumber>
<UploadId>4B1BF2F5DE064694870DD46E657F0CA6</UploadId>
</Error>
复制代码产生原因 经检查发现 ETag 为 undefined 解决方法 在阿里云 oss 控制台 基础设置 > 跨域规则设置 > 编辑规则 “暴露 Headers” 中增加 ETag 即可解决问题
作者:waanhappy 链接:https://juejin.im/post/5c4412186fb9a049d2365bbc 来源:掘金 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。