2 of 3
2
Simple S3 Upload Extension now on EE2 (current version: 1.2.1)
Posted: 16 June 2010 12:40 PM   [ Ignore ]   [ # 19 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 17 June 2010 01:10 PM   [ Ignore ]   [ # 20 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  09-15-2009

Am I correct when I assume that file sizes are limited by PHP settings?

 Signature 

A lover of good thinking, great music and EE.

Profile
 
 
Posted: 17 June 2010 01:13 PM   [ Ignore ]   [ # 21 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

that is correct.  they are also optionally limited by the max filesize setting when creating the custom field.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 23 June 2010 12:06 PM   [ Ignore ]   [ # 22 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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).

We also (finally) documented the fieldtype settings over here: http://www.emarketsouth.com/add-ons/simple-s3-uploader/settings/.  Sorry about the lack of explanation there! hmmm

Enjoy smile

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 05 July 2010 06:51 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Avatar
Total Posts:  27
Joined  12-11-2007

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.

I’m running the latest version in EE2.

 Signature 

Jedidiah Broadbent  |  Freelance Designer |  http://jedidiah.eu/

Profile
 
 
Posted: 05 July 2010 07:15 PM   [ Ignore ]   [ # 24 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 06 July 2010 04:47 AM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  27
Joined  12-11-2007

Thanks for the reply, I use the same key in Transmit and it works fine.  I checked the PHP info and you were correct, I’ve got PHP5 and curl.

libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

My secret key has a “/” and a “+” in it, guessing that isn’t a problem but not sure what else to check.

 Signature 

Jedidiah Broadbent  |  Freelance Designer |  http://jedidiah.eu/

Profile
 
 
Posted: 06 July 2010 06:38 AM   [ Ignore ]   [ # 26 ]  
Summer Student
Avatar
Total Posts:  27
Joined  12-11-2007

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.

Thanks for the help. =)

 Signature 

Jedidiah Broadbent  |  Freelance Designer |  http://jedidiah.eu/

Profile
 
 
Posted: 06 July 2010 07:32 AM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

glad it’s resolved itself for you.  hope you enjoy it! smile

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 08 July 2010 06:04 AM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  50
Joined  03-31-2009

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

Profile
 
 
Posted: 08 July 2010 10:43 AM   [ Ignore ]   [ # 29 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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.

Best regards,
-Ty

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 09 July 2010 03:51 AM   [ Ignore ]   [ # 30 ]  
Grad Student
Rank
Total Posts:  50
Joined  03-31-2009

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

Profile
 
 
Posted: 09 July 2010 09:29 AM   [ Ignore ]   [ # 31 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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:

curl_setopt($curlCURLOPT_FOLLOWLOCATIONtrue); 

Let me know if that works for you.
-Ty

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 09 July 2010 05:02 PM   [ Ignore ]   [ # 32 ]  
Summer Student
Total Posts:  7
Joined  10-15-2003

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

Any thoughts?

Profile
 
 
Posted: 09 July 2010 05:27 PM   [ Ignore ]   [ # 33 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

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:

public static $useSSL true

to

public static $useSSL false

hopefully that will solve this for you.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 09 July 2010 11:42 PM   [ Ignore ]   [ # 34 ]  
Grad Student
Rank
Total Posts:  50
Joined  03-31-2009
ender - 09 July 2010 01:29 PM

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:

curl_setopt($curlCURLOPT_FOLLOWLOCATIONtrue); 

Let me know if that works for you.
-Ty

Thanks, that seems to have done the trick!

Cheers
Andrew

Profile
 
 
Posted: 10 July 2010 01:22 AM   [ Ignore ]   [ # 35 ]  
Grad Student
Rank
Total Posts:  50
Joined  03-31-2009

Hello again. Just one more little question:

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?

Regards
Andrew Macpherson
Sydney, Australia

Profile
 
 
Posted: 10 July 2010 06:46 AM   [ Ignore ]   [ # 36 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1848
Joined  12-18-2008

look for the following lines in the ft.simple_s3_uploader.php file (they’ll be near the top of the _upload_to_s3() method:

$aws_object  preg_replace("/[^a-z0-9.]+/i""-"time("-" $pathinfo['filename'"." $pathinfo['extension']);
$aws_thumb   preg_replace("/[^a-z0-9.]+/i""-"time() . "-" $pathinfo['filename'"-thumb." $pathinfo['extension']); 

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
   
2 of 3
2