AWS PHP SDK版本2 S3文件名编码问题

编程入门 行业动态 更新时间:2024-10-28 12:26:45
本文介绍了AWS PHP SDK版本2 S3文件名编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们一直在使用AWS SDK与上传/抓取文件pretty的好成绩,但我们遇到了一个障碍。

We've been using the AWS SDK with pretty good results for uploading/grabbing files, but we ran into a snag.

有存储在S3中看起来就像是urlescaped一个文件。 / mefile / 412501_413000 / 412604_ 12%20C008%20Fil%20R [1] .doc.gpg

There is a file stored in S3 that looks like it was urlescaped. "/mefile/412501_413000/412604_-12%20C008%20Fil%20R[1].doc.gpg"

到目前为止,SDK已经成功地处理每一个错位的文件名,我们扔给它。但是,当我尝试了doesObjectExist我也得到一个失败的该文件。

So far the SDK has managed to handle every mangled filename we've thrown at it. But when I try a "doesObjectExist" I also get a failure for that file.

$s3->doesObjectExist("mabucket","/mefile/412501_413000/412604_-12%20C008%20Fil%20R[1].doc.gpg")

总是会失败。我试着上传从本地存储的文件,失败也是如此。我得到一个时髦的例外情况: 我们计算请求签名不您提供的签名相匹配。请检查您的密钥和签名方法。

will always fail. I've tried uploading that file from a local storage and that fails as well. I get a funky exceptions: "The request signature we calculated does not match the signature you provided. Check your key and signing method."

有什么诀窍,我需要连接code中的文件名使用了doesObjectExist之前。这似乎处理各种坏的文件名已经(空格/ UTF-8字符/&安培;等),所以我很困惑,为什么这不起作用

Is there any trick I need to encode the filename with before using the "doesObjectExist". It seems to handle all sorts of bad filenames already (spaces/utf-8 chars/& etc), so I'm confused why this doesn't work.

更新: 升级到最新的AWS SDK的PHP 2.2.1。在版本2.1.0,这显然有几个缺陷正在运行。如果你是在Ubuntu 10.04,这是一个有点粗糙。 (请参阅有关PHP版本升级跟贴:的 www.zalexblog/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/ )

UPDATE: Upgrading to the latest AWS SDK for PHP 2.2.1. Was running on version 2.1.0 which apparently had several bugs. If you are on Ubuntu 10.04, this is a bit rough. (See comments about PHP version upgrades here: www.zalexblog/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/)

推荐答案

升级到最新的AWS SDK的PHP 2.2.1。在版本2.1.0,这显然有几个缺陷正在运行。如果你是在Ubuntu 10.04,这是一个有点粗糙。 (请参阅有关PHP版本升级跟贴:的 www.zalexblog/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/ )

Upgrading to the latest AWS SDK for PHP 2.2.1. Was running on version 2.1.0 which apparently had several bugs. If you are on Ubuntu 10.04, this is a bit rough. (See comments about PHP version upgrades here: www.zalexblog/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/)

更多推荐

AWS PHP SDK版本2 S3文件名编码问题

本文发布于:2023-10-23 15:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件名   版本   PHP   AWS   SDK

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!