Download the PHP package cobaia/attach without Composer
On this page you can find all versions of the php package cobaia/attach. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cobaia/attach
More information about cobaia/attach
Files in cobaia/attach
Informations about the package attach
Attach 1.0
Attach is a CakePHP 2.0 Plugin, that makes uploads a simple task!
Attach contains a behavior that does everything for you, uploads your file, and resizes your images.
Requirements
- PHP 5.3 or >
- CakePHP 2.0 or >
Installation
- Clone from github : in your app directory type
git clone [email protected]:krolow/Attach.git Plugin/Attach
-
Download an archive from github and extract it in
app/Plugin/Attach
- If you require thumbnails for image generation, you should install the dependencies using composer, and make sure to call the autoload of composer in your CakePHP application
Usage
In a model that needs uploads, replace the class declaration with something similar to the following:
It's important to remember that your model class can have your own fields, and it will have a extra relation with Attachment model with the fields that are upload.
You also must create one table in your database:
You can do this with a schema:
Or you can do it with SQL:
Create your upload view, make sure it's a multipart/form-data form, and that the filename field is of the type 'file':
Attach automatically creates the relationship with the model Attachment, for each type that you define:
It will be always "Attachment" plus the type!
License
Licensed under The MIT License Redistributions of files must retain the above copyright notice.
Author
Vinícius Krolow - krolow[at]gmail.com