AetherUpload-Laravel icon indicating copy to clipboard operation
AetherUpload-Laravel copied to clipboard

大佬好,安装此扩展用于api接口上传,分片不能合并是什么原因?

Open ieiis opened this issue 1 year ago • 11 comments

//调用方式 $upload = new UploadController(); $infos = $upload->saveChunk();

ieiis avatar Aug 08 '22 02:08 ieiis

本插件是全自动完成的,不用写后端调用代码。你再仔细看下那个示例,上传完直接能返回文件保存地址,然后你表单点提交后存到数据库就行了,后端只需要写接收文件保存地址的代码。

peinhu avatar Aug 08 '22 03:08 peinhu

因为接口开发某些原因,我需要直接引用您的preprocess()和saveChunk()方法,参数正确会导致合并出问题不

ieiis avatar Aug 08 '22 03:08 ieiis

插件预设使用场景是网页表单上传,如果是API使用的话,客户端需要有和前端js相同的实现,两个路由(/aetherupload/preprocess,/aetherupload/uploading)提交的参数要相同,可以自己参考https://github.com/peinhu/AetherUpload-Laravel/blob/master/assets/aetherupload-core.js的参数和逻辑来写。

peinhu avatar Aug 08 '22 03:08 peinhu

如果参数、前端逻辑一样,应该不会有问题,等我有空试试。

peinhu avatar Aug 08 '22 03:08 peinhu

好的我这里自查一下感谢回复!!

ieiis avatar Aug 08 '22 03:08 ieiis

你前端其实也可以用我的后端逻辑?只要请求的路由是一样的,返回的结果也一样,只是你客户端的逻辑要自己写了。

peinhu avatar Aug 08 '22 03:08 peinhu

后端逻辑其实我都已经写好了,不需要使用者自己写或者主动调用的,API的话,关键还是写前端的逻辑,客户端是安卓IOS?

peinhu avatar Aug 08 '22 03:08 peinhu

嗯呢 目前是web端 应该是参数的问题吧

ieiis avatar Aug 08 '22 03:08 ieiis

请求路由 /aetherupload/preprocess
resource_name: example.zip
resource_size: 3509548
resource_hash: 508251fad2a81e3ec845800a4a440e51
locale: zh
group: file

请求路由 /aetherupload/uploading
resource_chunk: (二进制)
resource_ext: zip
chunk_total: 4
chunk_index: 1
resource_temp_basename: 1660012008535230
group: file
group_subdir: 202208
locale: zh
resource_hash: 508251fad2a81e3ec845800a4a440e51

参数按这个传就行了

peinhu avatar Aug 09 '22 02:08 peinhu

场景是网页表单上传,

后端还是要搬出来,因为要登录才能上传

Joycezhangw avatar Sep 06 '22 03:09 Joycezhangw

场景是网页表单上传,

后端还是要搬出来,因为要登录才能上传

这个支持自定义中间件的,可以在自定义中间件里面验证是否登录。

peinhu avatar Sep 06 '22 03:09 peinhu