Skip to content
New issue

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

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

Open
ieiis opened this issue Aug 8, 2022 · 11 comments

Comments

@ieiis
Copy link

ieiis commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 8, 2022

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

@ieiis
Copy link
Author

ieiis commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 8, 2022

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

@ieiis
Copy link
Author

ieiis commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 8, 2022

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

@ieiis
Copy link
Author

ieiis commented Aug 8, 2022

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

@peinhu
Copy link
Owner

peinhu commented Aug 9, 2022

请求路由 /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

参数按这个传就行了

@Joycezhangw
Copy link

场景是网页表单上传,

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

@peinhu
Copy link
Owner

peinhu commented Sep 6, 2022

场景是网页表单上传,

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants