【问题标题】:Getting mime type after file upload with Cloudinary使用 Cloudinary 上传文件后获取 MIME 类型
【发布时间】:2017-03-18 12:05:27
【问题描述】:

考虑使用 Cloudinary PHP API 上传文件:

\Cloudinary\Uploader::upload('http://www.example.com/image.jpg');

in the doumentation所述,基本响应不包括上传文件的mime-type

Array
(
  [public_id] => c87hg9xfxrd4itiim3t0
  [version] => 1371995958
  [signature] => f8645b000be7d717599affc89a068157e4748276
  [width] => 864
  [height] => 576
  [format] => jpg
  [resource_type] => image
  [created_at] => 2013-06-23T13:59:18Z
  [bytes] => 120253
  [type] => upload
  [url] => http://res.cloudinary.com/demo/image/upload/v1371995958/c87hg9xfxrd4itiim3t0.jpg
  [secure_url] => https://res.cloudinary.com/demo/image/upload/v1371995958/c87hg9xfxrd4itiim3t0.jpg
)

我是否必须在设置中配置某些内容才能将其添加到响应中?

【问题讨论】:

  • 除了已经返回的format 之外,您能否分享一些关于为什么需要 mime 类型的更多信息?

标签: php file-upload mime-types cloudinary


【解决方案1】:

检查其他人上传的内容的 mime 类型绝不安全。 它很容易被伪造。

如果您只想上传图片(如示例中),最安全的方法是使用 GD 或 ImageMagick 重新处理图片

【讨论】:

    猜你喜欢
    • 2021-11-15
    • 2011-07-03
    • 2012-11-03
    • 2018-12-01
    • 2018-08-14
    • 2011-06-09
    • 2011-05-08
    • 1970-01-01
    • 2014-05-19
    相关资源
    最近更新 更多