PHPackages                             xety/cake3-upload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. xety/cake3-upload

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

xety/cake3-upload
=================

Cake3 plugin to upload files.

v1.2(10y ago)2826.1k↓66.7%15[6 issues](https://github.com/Xety/Cake3-Upload/issues)[1 PRs](https://github.com/Xety/Cake3-Upload/pulls)1MITPHPPHP &gt;=5.4.16

Since Nov 2Pushed 9y ago9 watchersCompare

[ Source](https://github.com/Xety/Cake3-Upload)[ Packagist](https://packagist.org/packages/xety/cake3-upload)[ Docs](https://github.com/Xety/Cake3-Upload)[ RSS](/packages/xety-cake3-upload/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (1)

Cake3 Upload
============

[](#cake3-upload)

A Cake3 plugin to upload files.

[![Build Status](https://camo.githubusercontent.com/6f22dc4b0628d67c79e7d30419911881860d44f048a7630a72d4a7a0f9615a4c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f586574792f43616b65332d55706c6f61642e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Xety/Cake3-Upload)[![Coverage Status](https://camo.githubusercontent.com/2a2ef13b5f9757206a3f222c29784b4230ab6397143cc8233cbc11fd5c39ace7/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f586574792f43616b65332d55706c6f61642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/xety/Cake3-Upload)[![Scrutinizer](https://camo.githubusercontent.com/0fbf1a9297769241b149840bf6202e07eadda28132395b7d5457e92ff4927c6b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f586574792f43616b65332d55706c6f61642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Xety/Cake3-Upload)[![Latest Stable Version](https://camo.githubusercontent.com/e80572f5fe6dcfb263119a3fded5951cb90061dc4cf2ac8c14d34ed6925a1e2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f586574792f43616b65332d55706c6f61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xety/cake3-upload)[![Total Downloads](https://camo.githubusercontent.com/011df4de612c0c5091418999977c18ef16df60db6e0d92b820cdf88931c2ccfa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f786574792f63616b65332d75706c6f61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xety/cake3-upload)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xety/cake3-upload)

Requirements
------------

[](#requirements)

- CakePHP 3.X

Installation
------------

[](#installation)

Run : `composer require xety/cake3-upload:1.*`Or add it in your `composer.json`:

```
"require": {
	"xety/cake3-upload": "1.*"
},
```

Usage
-----

[](#usage)

In your `config/bootstrap.php` add :

```
Plugin::load('Xety/Cake3Upload');
```

In your model `initialize()`:

```
$this->addBehavior('Xety/Cake3Upload.Upload', [
		'fields' => [
			'avatar' => [
				'path' => 'upload/avatar/:id/:md5'
			]
		]
	]
);
```

Set your form to accept files

```
	$this->Form->create($foo, ['type'=>'file']);
	// .. or ..
	$this->Form->create($foo, ['enctype' => 'multipart/form-data']);
```

To create an input to upload a file, just use the this rule : **fieldName\_file**. Example :

```
