Last active
August 29, 2015 14:23
-
-
Save vaughany/ec10bc8219b9e47793de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Database schema | |
CREATE TABLE users ( | |
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, | |
email VARCHAR(100) NOT NULL, | |
password VARCHAR(100) NOT NULL, | |
firstname VARCHAR(50) NOT NULL, | |
lastname VARCHAR(50) NOT NULL, | |
avatar VARCHAR(200) NOT NULL, | |
created DATETIME DEFAULT NULL, | |
modified DATETIME DEFAULT NULL, | |
UNIQUE KEY (email) | |
); | |
// In Model/Table/UsersTable.php | |
$this->addBehavior('Utils.Uploadable', [ 'avatar' ]); | |
// In Template/Users/edit.ctp | |
$this->Form->create($user, ['type' => 'file']); | |
... | |
echo $this->Form->input('avatar', ['type' => 'file']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment