AWS PHP SDK版本2 S3文件名编码问题 [英] AWS PHP SDK Version 2 S3 filename encoding issue

查看:320
本文介绍了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.

<$c$c>$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版本升级跟贴:的 http://www.zalexblog.com/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: http://www.zalexblog.com/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版本升级跟贴:的 http://www.zalexblog.com/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: http://www.zalexblog.com/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/)

这篇关于AWS PHP SDK版本2 S3文件名编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆