Amazon S3
Amazon S3 is an online storage web service offered by Amazon Web Services. My company have being used to host some images for a while, and it works great, fast and cheap.
Recently, I found a handy tool called s3up, which lets you
upload files using custom headers so they’re served back with a proper expiration date and gzipped when possible — i.e., the techniques recommended by YSlow.
And I have used it to upoad some Javascripts to be hosted on Amazon S3, which largely reduces my company server's bandwidth usage. But there is small issue when you use this command line tool in old version of PHP (<5.2). PHP has a function to return information about a file, but this function does not return PATHINFO_FILENAME constant until PHP 5.2.0. So, you have to tweak the code little bit, for example, I added a custom function (Credit: Lostindream at atlas dot cz) below to get FILENAME constant for PHP < 5.2.0.
So the revised version is here. The usage can be found from original post. I doubt people is using Amazon S3 in China, so this post is in English. If you are interested in Amazon S3 and have any related questions, please leave your message.function path_info($filePath){$fileParts = pathinfo($filePath);if(!isset($fileParts['filename'])){$fileParts['filename'] = substr($fileParts['basename'], 0, strrpos($fileParts['basename'], '.'));}return $fileParts;}
标签: PHP



0 条评论:
发表评论
指向此帖子的链接:
创建链接