If you want to chat about how you’d like to see this work or any other thoughts you have on the matter, hit me up via Skype or PM. I’d like to hear what you’re thinking, maybe compare notes.
I’m pleased to announce version 1.2.0 of the Simple S3 Uploader. This version adds a number of cool and useful features:
1) ExpressionEngine 2 support! The EE2 port wasn’t easy or quick, but we made it. We were able to take advantage of a few of EE2’s new features, most notably the improved publish page validation callbacks. Now when an upload fails you’ll have a lot more information about why (what? you mean you didn’t enjoy the blank white page in EE1 when things failed? nonsense…).
2) Buckets can be created in different S3 regions. Pretty self-explanitory.
3) A new setting that allows you to specify that all files uploaded to a custom field will be private. This means Joe Public cannot navigate directly to your file on S3 to download it, or hotlink it on another site that drives your bandwidth costs up, etc.
3a) New output functions for S3 authenticated urls. When a file is uploaded as private you’ll need a new way to give people access to it. Now you can generate links to your files that expire after a certain amount of time. The link is authenticated using your S3 account (since you own the files) and is good for the number of minutes you specify in the tag parameter (default 60). This link can also use SSL (https) if you need to have it be encrypted during download (also useful if you need to use images stored on S3 on a secure page… browsers show warnings if you include non-secure items on a secure page).
Just bought this from Devotee and excited to give it a go but having trouble getting it setup,
It installed ok but when adding a new custom field it returns:
An Error Was Encountered
S3::listBuckets(): [InvalidAccessKeyId] The AWS Access Key Id you provided does not exist in our records.
I’ve double checked the KeyID and Secret key and have issued a new set, but no luck. I’ve tried with new bucket names and with an existing bucket. Not sure what else to try.
hmm… if you use those same keys through say S3Fox does it allow you to access your buckets?
If that works, does your server meet the requirements? PHP 5 with cURL support is necessary for this add-on. You can find this out by going to your control panel and selecting Tools > Utilities > PHP Info. The PHP version will be near the top of the page and you should be able to search for the text “cURL support” on the page to see if you’ve got that running.
I’m pretty sure that you meet the requirements because you’d most likely get a PHP syntax error trying to use it on PHP 4 and you probably wouldn’t get the response from Amazon S3 in the first place if you didn’t have curl… so I’m not entirely sure what the problem is if your credentials are working.
Tried it again and it is fine. I found an old thread on the amazon forums where people where having similar issues with newly created aws accounts. So I’m guessing the problem was on their end.
I am thinking about buying this add-on, but first I’d like to know whether or not it can add custom headers on upload. I would really like to be able to set Cache-Control headers, for example, preferably on a file-by-file basis if possible but even having a default setting might be enough.
Thanks in advance for any help you can give.
Andrew Macpherson
Sydney, Australia
Thanks for the question/feature request. I just implemented a setting which will allow the cache control header to be set and uploaded the new version (1.2.1) to devot:ee.
Thank you!
And k-ching!
Just purchased the add-on.
Only one little thing, though: I’m getting the following error when I try to set up a new field:
An Error Was Encountered
curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
I’ve checked PHP info on the server, and CURL support is enabled ...
It also says that safe_mode is off
Unfortunately, though, the open_basedir does indeed have a “local value” (but not a “master value”)
Any idea what I should be doing now? I assume the service provider (EngineHosting) must have set the local value. Is it something that I should be asking them about? I have no idea what open_basedir does ...
Thanks in advance for any advice you may be able to give
Andrew
Basically open_basedir prevents PHP from changing to a directory outside of the one it has been assigned, restricting it to a virtual fenced in area. Because cURL is not strictly a part of PHP and cannot access the open_basedir settings, and because CURLOPT_FOLLOWLOCATION could follow redirects outside of the fenced area, it has been made to throw an error in the newer versions of PHP. I know that this extension has worked on EngineHosting in the past, so it’s possible that they recently upgraded to a new version of PHP.
You should be able to comment that line out and be fine as I don’t believe S3 will issue any redirects for the requests this extension sends.
For EE1, comment out line 2194 in ft.simple_s3_uploader.php
For EE2, comment out line 1256 in libraries/S3.php
in both cases the line to comment out looks like this:
This is on a clean install in EE2 I keep getting this error:
S3::listBuckets(): [60] SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
sounds like your OpenSSL/cURL certificates aren’t set up properly on the server. might want to ask whoever manages your server about that. if you google for that error you can read some information about it.
In the meantime, you should be able to avoid the error by disabling SSL.
On line 44 of libraries/S3.php you should be able to change:
Basically open_basedir prevents PHP from changing to a directory outside of the one it has been assigned, restricting it to a virtual fenced in area. Because cURL is not strictly a part of PHP and cannot access the open_basedir settings, and because CURLOPT_FOLLOWLOCATION could follow redirects outside of the fenced area, it has been made to throw an error in the newer versions of PHP. I know that this extension has worked on EngineHosting in the past, so it’s possible that they recently upgraded to a new version of PHP.
You should be able to comment that line out and be fine as I don’t believe S3 will issue any redirects for the requests this extension sends.
For EE1, comment out line 2194 in ft.simple_s3_uploader.php
For EE2, comment out line 1256 in libraries/S3.php
in both cases the line to comment out looks like this:
I notice that the files I have been uploaded are being renamed (using numbers). Is there any way to change that behaviour, so that they keep the original file name?
you can remove the time() part of the expression if you need to alter this behavior.
You may have your reasons for doing this, but note that the original filename is still available to you via the {my_custom_field:name} template tag. All template tags can be found here. If multiple people are going to be uploading files, the timestamps ensure that nobody overwrites anyone else’s stuff.