\S3File
DataObject reprensetation of a file stored in AWS S3.
Allows you to retrieve the file once its been uplaoded to S3. You can link
other data object to this class to define relationship to your S3 file.
- Author: Maxime Rainville <max@firebrand.nz>
Synopsis
class S3File
extends DataObject
{
- // methods
- public FieldList getCMSFields()
- protected null onBeforeWrite()
- public string getFilename()
- public string getExtension()
- public string Icon()
- public String appCategory()
- public string getTemporaryDownloadLink()
- public string getSizeForHuman()
- protected S3Client getS3Client()
- protected onAfterDelete()
- public SSViewable forTemplate()
- protected array defaultTemplate()
Hierarchy
Extends
- DataObject
Members
private
- $db
—
array
Database property of an S3 File - $s3
—
Aws\S3\S3Client
AWS SDK S3 client
Methods
protected
- defaultTemplate() — List of templates to render this S3File
- getS3Client() — Get a AWS SDK S3 Client to prepare and execute S3 request against your bucket
- onAfterDelete() — Delete the file from the S3 bucket when the S3File DataObject gets deleted.
- onBeforeWrite() — If not title is provided, guess a title from the file name before writting the S3File info to the DB
public
- Icon() — URL to an appropriate 32x32 pixel icon.
- appCategory() — Returns a category based on the file extension.
- forTemplate() — Display a reprensetation of this S3File in a SS template/
- getCMSFields() — Custimize the form fields to edit this S3 File
- getExtension() — Return the extension of the file based on its name.
- getFilename() — The UploadField template expect a filename attribute, so it can retrieve a thumbnail. Since we don't need this we just return an empty string.
- getSizeForHuman() — Generate a human friendly reprensetation of the size of this S3file
- getTemporaryDownloadLink() — Generate a presigned URL to download the file. This will allow users to download the file without making the file public for everyone to see or download.