DrMabuse23/yii2-sir-trevor-js — pull request #1 by schmunk42 (2014-07-22 18:32:29+00:00)
Title: reverted param naming to 'attribute'

Sample upload action:

```
/**
* Action for file uploads via sir-trevor image block from SirTrevorWidget (input widget)
*
* @param $root relative base folder
*/
public function actionSirTrevorUpload($root)
{
$upload = UploadedFile::getInstanceByName('attachment[file]');

$model = new File();
$model->name_id = Inflector::slug(str_replace($upload->extension, '', $upload->name));
$model->name_id = $this->checkFileNameNotExist($model);
$model->path = 'images/' . $root . '/' . $model->name_id . '.' . $upload->extension;
$savePath = \Yii::getAlias('@backend/web') . '/' . $model->path;

if (!is_file($savePath) && is_dir(dirname($savePath))) {
if ($upload->saveAs($model->path)) {
$model->mime_type = FileHelper::getMimeType($model->path);
$model->file_size = $upload->size;
if ($model->save()) {
$items = $this->getItems($this->rootPath);
list($width, $height, $type, $attr) = getimagesize($model->path);
echo Json::encode(['file' => ['url' => $model->path]]);
return;
} else {
echo "Database record could not be saved.";
}
} else {
echo "File could not be saved.";
}
} else {
echo "File exists or root folder '{$savePath}' not found.";
}
}
````