Skip to content

Instantly share code, notes, and snippets.

@vaughany
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save vaughany/ec10bc8219b9e47793de to your computer and use it in GitHub Desktop.

Select an option

Save vaughany/ec10bc8219b9e47793de to your computer and use it in GitHub Desktop.
// 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