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

关于前端上传callback #211

Closed
liangxiwei opened this issue Jul 2, 2024 · 6 comments
Closed

关于前端上传callback #211

liangxiwei opened this issue Jul 2, 2024 · 6 comments

Comments

@liangxiwei
Copy link

请问在使用cos.uploadFile的时候,callback应该怎么传递?

我在demo.js上看到是可以直接传递Callback参数的,但实际代码ts却没有相关参数提示,拿不准是demo.js里的代码比较老了还是ts没加上去。

@liangxiwei
Copy link
Author

还有callback url在哪里填写呢?

@liangxiwei liangxiwei changed the title 关于上传callback 关于前端上传callback Jul 2, 2024
@livehigh
Copy link
Collaborator

livehigh commented Jul 2, 2024

还有callback url在哪里填写呢?

可参考 https://github1s.com/tencentyun/cos-js-sdk-v5/blob/master/demo/demo.js#L919-L920

@liangxiwei
Copy link
Author

试出来了,你们这个ts有没有类型提示,而且本身callback是有bug的。
如果上传的是一个非图片文件,使用了imageInfo参数,比如:bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}

回调是不成功的,只有去掉imageInfo才行。。

@livehigh
Copy link
Collaborator

livehigh commented Jul 2, 2024

试出来了,你们这个ts有没有类型提示,而且本身callback是有bug的。 如果上传的是一个非图片文件,使用了imageInfo参数,比如:bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}

回调是不成功的,只有去掉imageInfo才行。。

  • ts 类型下个版本补上哈。
  • exif、imageInfo 变量仅支持图片文件,videoInfo 仅支持音视频文件,格式不符将导致回调失败(错误码 203)。是这样的哈。

@livehigh livehigh closed this as completed Jul 3, 2024
@liangxiwei
Copy link
Author

试出来了,你们这个ts有没有类型提示,而且本身callback是有bug的。 如果上传的是一个非图片文件,使用了imageInfo参数,比如:bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}
回调是不成功的,只有去掉imageInfo才行。。

  • ts 类型下个版本补上哈。
  • exif、imageInfo 变量仅支持图片文件,videoInfo 仅支持音视频文件,格式不符将导致回调失败(错误码 203)。是这样的哈。

你仔细想想这个逻辑有没有问题,用户一个pdf文件,愣是改成png后缀上传,前端根本没法判断是不是真的png,这就有问题。看看隔壁家的,不管你是不是图片,填了也不会导致整个上传流程走不下去。

@livehigh
Copy link
Collaborator

livehigh commented Jul 5, 2024

试出来了,你们这个ts有没有类型提示,而且本身callback是有bug的。 如果上传的是一个非图片文件,使用了imageInfo参数,比如:bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}
回调是不成功的,只有去掉imageInfo才行。。

  • ts 类型下个版本补上哈。
  • exif、imageInfo 变量仅支持图片文件,videoInfo 仅支持音视频文件,格式不符将导致回调失败(错误码 203)。是这样的哈。

你仔细想想这个逻辑有没有问题,用户一个pdf文件,愣是改成png后缀上传,前端根本没法判断是不是真的png,这就有问题。看看隔壁家的,不管你是不是图片,填了也不会导致整个上传流程走不下去。

回调失败但是上传成功的,不会影响整个流程

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

2 participants