The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
wanzi2019

阿里云 oss 的 GO 语言 SDK 分片上传不支持文件流吗

  •  
  •   wanzi2019 · Oct 22, 2021 · 1897 views
    This topic created in 1686 days ago, the information mentioned may be changed or developed.

    官方示例里边是本地文件的地址,是必须要前端传过来然后保存到服务器才可以吗,不能直接文件流吗

    4 replies    2021-10-22 15:05:33 +08:00
    Vegetable
        1
    Vegetable  
       Oct 22, 2021
    官方 sdk 的用法是 bucket.PutObject(string, io.Reader),所以当然支持将前端上传的文件流直接接入进去,不过可能会出现 Content-Length 的问题,这个我不确定是不是和 S3 一样的。

    然后我问一下哈,你们用 OSS 是前端->后端->OSS 这么传的吗?我更喜欢直接 presignedurl 直接发给前端,不然上传过程中服务器岂不是亚历山大?
    wanzi2019
        2
    wanzi2019  
    OP
       Oct 22, 2021
    @Vegetable 好的了解了,谢谢你的建议
    Orenoid
        3
    Orenoid  
       Oct 22, 2021
    @Vegetable #1 我们是前端直传 OSS
    yin1999
        4
    yin1999  
       Oct 22, 2021 via Android   ❤️ 1
    后端签名后,由前端直传,可以加上回调或者函数计算来做上传后的后续处理
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5721 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 03:06 · PVG 11:06 · LAX 20:06 · JFK 23:06
    ♥ Do have faith in what you're doing.