GithubHelp home page GithubHelp logo

Comments (10)

lewzylu avatar lewzylu commented on June 24, 2024

If you upload without the content-type header, you will carry the application/octet-stream by default, which will be automatically converted to the corresponding content-type when you download it.

from cos-php-sdk-v5.

xiebruce avatar xiebruce commented on June 24, 2024

这还得自己指定啊,我看别的云都是默认文件本身的content-type的,因为你用application/octet-stream的话,会导致在网页上查看不了图片,会变成下载,有时候想看看图片就不方便。我用aws s3兼容接口上传就正常,文件本来的mime是什么上传后就是什么,都不用自己指定,所以你们这个这么搞有点不太科学

from cos-php-sdk-v5.

lewzylu avatar lewzylu commented on June 24, 2024

感谢您的建议,这个地方的产品策略我们先内部对齐一下

from cos-php-sdk-v5.

xiebruce avatar xiebruce commented on June 24, 2024

好的,谢谢!

from cos-php-sdk-v5.

lewzylu avatar lewzylu commented on June 24, 2024

这应该是guzzle6版本phpsdk的一个bug,默认会携带application/octet-stream的头部去上传。现在已经修复,如果不带cotent-type上传的文件,浏览器下载时会默认预览

from cos-php-sdk-v5.

xiebruce avatar xiebruce commented on June 24, 2024

修复了后面再发版本是吗?

from cos-php-sdk-v5.

lewzylu avatar lewzylu commented on June 24, 2024

可以先用一下dev的版本,这边ut覆盖率上去后就会release2.0.0

from cos-php-sdk-v5.

xiebruce avatar xiebruce commented on June 24, 2024

好的

from cos-php-sdk-v5.

nagatoyk avatar nagatoyk commented on June 24, 2024

临时决解方案是修改Qcloud\Cos\Request\BodyLocation.php的第48行
$request = $request->withHeader('Content-Type', 'application/octet-stream');
修改为如下代码即可变更header
$request = $request->withHeader('Content-Type', $command->hasParam('contenttype')?$command['contenttype']:'application/octet-stream');
之后用链接便可直接浏览不再下载

from cos-php-sdk-v5.

xiebruce avatar xiebruce commented on June 24, 2024

@nagatoyk 官方已经解决了

from cos-php-sdk-v5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.