Search

A new extension, “S3 Upload Field” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

This is a project of Brian Zerangue’s that I picked up. As the Readme says, it tests fine, but I’m releasing it to get ideas for additional S3-related function people may want added before I make it a final release.

It also has quite a bit of ‘vestigial’ code from the upload field to be cleaned up.

Just some ideas for additional functionality:

  • Proxy the file through Symphony to obfuscate S3 (can’t think of a good reason why, but it’d be possible)
  • Configurable permissions for various uses (e.g. non-world readable files)
  • Compatible data source to browse your buckets
  • Creation of new bucket while creating field in Section editor

Awesome Andrew! I’m sorry my PHP skills are lacking and wasn’t able to wrap my head fully around this one. GREAT JOB!

Andrew, when I install the Amazon S3 Upload Field I get the result that it kills the ability to edit or create new sections in the Symphony backend. If I click on a section or to create new section there’s just a white screen?

Add php_value Display Errors 1 to your .htaccess to get some idea of what error is happening.

Hey Brendo

Did that and got:

Parse error: syntax error, unexpected ‘)’ in /Applications/MAMP/htdocs/symphonys3/extensions/s3upload_field/fields/field.s3upload.php on line 135

Fixed that and now I’m getting a new error if I try to create a section:

S3::listBuckets(): [60] SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3GETSERVERCERTIFICATE:certificate verify failed An error occurred in /Applications/MAMP/htdocs/symphonys3/extensions/s3uploadfield/lib/S3.php around line 90

90: triggererror(sprintf(“S3::listBuckets(): [%s] %s”, $rest->error[‘code’], $rest->error[‘message’]), EUSER_WARNING);

Okay that error went away when I moved from a local environment to my test server. But now I get as far as creating the section but when I add the S3 Upload Field I get a Symphony Fatal Database error:

Column ‘field_id’ cannot be null An error occurred while attempting to execute the following query INSERT INTO sym_fields_s3upload (field_id, bucket, validator) VALUES (NULL, ‘*my-bucket-name*’, NULL)

Hi almacmillan,

Sorry, I was off the grid this weekend; I’ll try to take a look at this tonight.

Any update ashooner?

Almacmillan,

Sorry for the delay with this. I’ve updated the repo with the fix. Please let me know if it solves your problem when you get a chance. Thanks!

Is this Extension good to go? as in working with 2.1.2 out in the wild? would like to test it out on a new setup with my S3 account see… :)

Hi Moonoo2,

I haven’t tested it past 2.1.0. Please give it a go and let me know if you have any issues. If you do run into problems, just post them on the tracker.

Neat. A couple of points to note:

 * you can set a cname in dns to obfuscate the URL

 * hook a different s3 bucket up to cloudfront and use that for content that needs served faster. (noting the use of cloud front is more costly)

Rgds

I trying to use this extension with Symphony 2.2.

and I get following error when trying to access or create a section:

preg_match(): Delimiter must not be alphanumeric or backslash
An error occurred in /Users/defaultuser/Sites/defaultsite.lan/symphony/lib/toolkit/class.general.php around line 874


869:                     or in_array($file, $exclude)
870:                     or in_array("$dir/$file", $exclude)
871:                 ) continue;
872:
873:                 if(!is_null($filter)) {
874:                     if(!preg_match($filter, $file)) continue;
875:                 }
876:
877:                 $files[] = str_replace($strip_root, '', $dir) ."/$file/";
878:

Backtrace:

[:0] GenericErrorHandler::handler();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/toolkit/class.general.php:874] preg_match();
[/Users/defaultuser/Sites/defaultsite.lan/extensions/s3upload_field/fields/field.s3upload.php:40] General::listDirStructure();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/content/content.blueprintssections.php:398] FieldS3Upload->displaySettingsPanel();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/toolkit/class.administrationpage.php:440] contentBlueprintsSections->__viewEdit();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/toolkit/class.administrationpage.php:397] AdministrationPage->__switchboard();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/toolkit/class.administrationpage.php:260] AdministrationPage->view();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/core/class.administration.php:221] AdministrationPage->build();
[/Users/defaultuser/Sites/defaultsite.lan/symphony/lib/core/class.administration.php:374] Administration->__buildPage();
[/Users/defaultuser/Sites/defaultsite.lan/index.php:25] Administration->display();

ANy ideas how to fix this?

Hi qnn,

I have not updated this for 2.2, and it probably deserves a rewrite. I'll take a look to see if there is a quick fix and let you know.

I think this is a compatibility problem with the listDirStructure function in the General class. Its signature changed somewhere along the line. Should be a simple case of checking what arguments it accepts and what parameters you're passing in the extension. From memory, you might be passing a boolean when it expects a regex string (or the other way around).

@nickdunn - in line 40...

$directories = General::listDirStructure(WORKSPACE, true, 'asc', DOCROOT, $ignore);

I changed it to ...

$directories = General::listDirStructure(WORKSPACE, null, 'asc', DOCROOT, $ignore);

It got rid of the error above and then when I choose the bucket to upload to in my section, and go to add a new entry, when I save the entry, it actually does upload the file to Amazon S3, but it gives me back this Symphony error...

unlink(/Users/defaultuser/Sites/defaultuser.local/public/workspace/): Operation not permitted
    /Users/defaultuser/Sites/defaultuser.local/public/symphony/lib/toolkit/class.general.php line 811

    806      *  true if the file is successfully unlinked, if the unlink fails and
    807      *  silent is set to true then an exception is thrown. if the unlink
    808      *  fails and silent is set to false then this returns false.
    809      */
    810     public static function deleteFile($file, $slient=true){
    811         if(!@unlink($file)){
    812             if($slient == false){
    813                 throw new Exception(__('Unable to remove file - %s', array($file)));
    814             }
    815

Anybody know how to fix this error?

unlink(/Users/defaultuser/Sites/defaultuser.local/public/workspace/): Operation not permitted

Looks like it's incorrectly trying to delete a directory not a file.

I did the same thing and got rid of the first error. It uploaded the file but my browser either just stalled or gave me the same error as you got...

I hope this extension gets a fix... I got my site up and running on amazon and I'd like to see how far can I take it... I'll also look into it myself later today...

@qnn - did you find a solution? I've still yet to figure it out. Unfortunately, my php skills are lacking.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details