Code Monkey home page Code Monkey logo

s3upload_field's Introduction

Field: Amazon S3 File Upload

This extension functions as a basic replacement for file uploads, allowing hosting on Amazon S3 (it requires an Amazon S3 account). Uploaded files are world readable. It is not considered feature-complete; there is much additional functionality that could be added . If you have input, please contact us at the Symphony forum.

Installation

  1. Upload /s3upload_field to your Symphony /extensions folder.
  2. Enable it by selecting the "Field: Amazon S3 Upload", choose Enable from the with-selected menu, then click Apply.
  3. Under Preferences, add your S3 Access Key ID and Secret Access Key.
  4. You can now add the "Amazon S3 File Upload" field to your sections. Select the bucket you wish to store files in from the dropdown.

Origin

This extension is a variation of the 'Unique File Upload Field' extension by Michael Eichelsdoerfer and the Akismet extension (for System Preferences) by Alistair Kerney. It uses the Amazon S3 PHP class written by Donovan Schonknecht. This extension was started by Brian Zerangue, taken over by Andrew Shooner, and some slight modifications to get it working with Symphony 2.2 were made by Scott Tesoriere.

s3upload_field's People

Contributors

ashooner avatar brendo avatar bzerangue avatar jdsimcoe avatar michael-e avatar scottkf avatar thejester12 avatar tonyarnold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s3upload_field's Issues

putObject Error

So Symphony is throwing up this error:

User Warning: GenericErrorHandler 512: S3::putObject(): [AccessDenied]
Access Denied on line 358 of file /Users/jdsimcoe/Sites/fire/extensions/s3upload_field/lib/S3.php

I have a user policy on my S3 bucket that allows uploading/deleting and have tested this in Transmit successfully.

Here is my policy:

{
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "s3:ListAllMyBuckets"
         ],
         "Resource":"arn:aws:s3:::*"
      },
      {
         "Effect":"Allow",
         "Action":[
            "s3:ListBucket",
            "s3:GetBucketLocation"
         ],
         "Resource":"arn:aws:s3:::bucket-name"
      },
      {
         "Effect":"Allow",
         "Action":[
            "s3:PutObject",
            "s3:GetObject",
            "s3:DeleteObject"
         ],
         "Resource":"arn:aws:s3:::bucket-name/*"
      }
   ]
}

Any ideas?

Version 0.9 defaults to private; even though the code is set to public-read

I am using Symphony 2.3.6 on a very large site. After upgrading from version 0.7 to 0.9, every time I would upload something, it would mark it as private. It seemed to be ignoring the public-read (default setting)...

https://github.com/symphonists/s3upload_field/blob/master/fields/field.s3upload.php#L378

Anyway, I tried re-installing it and same issue. I moved back to version 0.8.1 and that corrected the issue. But that version of the extension was before the new S3 library was added to this extension.

It looks as if version 0.9 of the extension isn't recognizing the public-read ACL (or is just plain ignoring it, and setting it as private (Owner access only).

No upload, no error

Hi Brian,

I'm having a great deal of difficulty getting this working. I've created a new bucket, and set my access keys correctly (I can see the bucket list in the Section editor). Every time I try to upload, nothing happens — no file is uploaded to S3 and nothing is logged. An empty database row is added to the database the first time, and then not updated after that. Any ideas?

Cannot save entries

I get this error when saving entries (2.3.3)

Symphony Warning: Illegal string offset 'error'

An error occurred in /Applications/MAMP/htdocs/XXXX/extensions/s3upload_field/fields/field.s3upload.php around line 323



318         catch (Exception $e) {
319             $message = __('The bucket %s doesn\'t exist! Please update this section.', array($this->get('bucket')));
320             return self::__INVALID_FIELDS__;    
321         }
322
323         if(empty($data) || $data['error'] == UPLOAD_ERR_NO_FILE) {
324
325
326             if($this->get('required') == 'yes'){
327                 $message = __("'%s' is a required field.", array($this->get('label')));

Losing access to S3 intermitrtently

Looks like Amazon are changing the way you access the S3 infrastructure.

They seem to want you to setup IAM users and assign policies to each user.

We encountered an issue where connections to the service weren't being allowed, but no message or indication that the creds weren't connecting. Has there been any updates that present us with notification of successful or unsuccessful connection to the S3 landscape from the preferences page at all?

Datasource output for empty fields is not very "Symphony-like"

If a file does not exist, datasource output will look similar to this:

<bild url="https://mybucket.s3.amazonaws.com/">
    <filename/>
    <size/>
    <mimetype/>
</bild>

I see two problems here:

  1. A URL is still added, although there is no file.
  2. Empty elements are output (while Symphony normally omits empty elements).

Well, that's no big deal, but it's not very consistent with Symphony's style either.

Wrong error message when field is required

When the field is required, an attempt to save an entry from the frontend without any file will result in something like the following:

<events>
    <my-section result="error">
        <filter name="permission" status="passed" />
        <message>Entry encountered errors when saving.</message>
        <image label="Image" type="invalid" message="'Image' is a required field." />
        <post-values>
            <title>My Title</title>
            <date>2014-09-21 17:10</date>
            <image>
                <error>4</error>
            </image>
        </post-values>
    </my-section>
</events>

I tried to find out why I get type="invalid" while the error message is correct—to no avail. Maybe @brendo has an idea? Or somebody else?

Maintaining folders on buckets

I'm just wondering if anyone has used this extension to allow the fields to upload files into a nested folder structure on the bucket? As I understand, this field currently uploads all files into the root of the bucket.

My client requires that images go into an /images folder on the same bucket as files (which would live in /files folder). It seems to be a simple file naming convention which allows the files to be displayed a traditional folder structure via the AWS console, the file just needs to be uploaded with the 'folder' prefixed to the filename.

I'm thinking of enabling this just by having an additional setting on the field which prepends the value to the file upon upload, eg. '/images' would be added to beach.jpg to allow it to live in http://s3.amazonaws.com/{bucket}/images/beach.jpg

Has anyone does this before (happy to merge rather than develop from scratch) :)

Feature Request: Add Progress Indicator to this extension

It would be great to have a basic progress indicator with this extension. Since many people use S3 to hold larger documents, or audio, or video. It would be nice to have a progress indicator to show the progress of the upload.

Future of this extension

I noticed that the S3 library used in this extension doesn't seem to be maintained well anymore. It has some open issues and rather few commits. In addition it doesn't work with AWS Signature Version 4, which is needed for any new regions after January 30, 2014. (For example, the new "Frankfurt" region.)

So I think about switching to the official AWS SDK for PHP. Of course, this is a big library… But probably this one will be maintained better. (And I verified that it's working with Signature Version 4.)

Any thoughts on this?

Should I rather build a separate/new extension?

Is there anybody who has time and interest to help with this (starting not now, but in the next few weeks)?

Stop autofill of access key

While deploying a client site this week, we twice got bitten by Chrome prefilling the access key value on the Preferences page.

It would prefill this data with our Symphony password, and then as we'd save the preferences, the key would be overridden and access to S3 was lost.

This happened twice because we enabled and then disabled maintenance mode!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.