Я пытаюсь использовать плагин для загрузки cakePHP, просто загрузил последнюю версию.cakephp 2.0 Загрузить плагин
Я на сервере Bluehost PHP 5.
хохлатая тестовая таблица, аналогично примеру, в документации
вот add.ctp
<?php
/**
File: office_apps/view/VwImageTest/add.ctp
Created: 3/19/2015 - mfm
**/
?>
<div class="imagetest form">
<?php
echo $this->Form->create('VwImageTest', array('type' => 'file'));
echo $this->Form->input('code');
echo $this->Form->input('description');
echo $this->Form->input('image', array('type' => 'file'));
echo $this->Form->input('image_dir', array('type' => 'hidden'));
echo $this->Form->end('Add');
?>
</div>
<div class="actions">
<h3>Actions</h3>
<ul>
<li><?php echo $this->Html->link('List Images', array('action' => 'index'));?></li>
</ul>
</div>
Здесь ошибка Я получаю, когда нажата кнопка «Добавить». Ошибка: SQLSTATE [42S22]: Column не найдено: 1054 Неизвестный столбец 'Массив' в 'списке поля'
запроса, представленный приложением SQL запросов: INSERT INTO thewoode_virtual_workshop
. vw_image_tests
(code
, description
, image_dir
, image
, modified
, created
, id
) VALUES ('PKFPBU', 'Vertex Нажмите Pen Втулку', '', массив, '2015-03-19 12:24:29', «2015- 03-19 12:24:29' , '550b145d-0dbc-4764-845f-41ee45591f3e')
здесь файл Модель
<?php
/**
* file: office_apps/model/vw_image_test.php
*
* Image Test Model
*/
class VwImageTest extends AppModel {
var $name = 'Image Test';
var $useTable = 'vw_image_test';
/*
public $actsAs = array(
'Upload.Upload' => array(
'image'
)
);
*/
public $actsAs = array(
'Upload.Upload' => array(
'image' => array(
'fields' => array(
'dir' => 'image_dir'
)
)
)
);
}
?>
<?php
/**
* file: office_apps/model/vw_image_test.php
*
* Image Test Model
*/
class VwImageTest extends AppModel {
var $name = 'Image Test';
var $useTable = 'vw_image_test';
/*
public $actsAs = array(
'Upload.Upload' => array(
'image'
)
);
*/
public $actsAs = array(
'Upload.Upload' => array(
'image' => array(
'fields' => array(
'dir' => 'image_dir'
)
)
)
);
}
?>
попытаемся это снова
<?php
/*
File: ../virtual_studio/office_apps/Controller/VwImageTestController.php
Created: 3/19/3025 by mfm
*/
class VwImageTestController extends AppController {
public $components = array('Session');
public $helpers=array('Html','Form','Session');
public function index() {
$this->set('imagetest', $this->VwImageTest->find('all'));
}
public function add() {
if (!empty($this->request->data)) {
$this->VwImageTest->create($this->request->data);
if ($this->VwImageTest->save()) {
$this->Session->setFlash('This image has been save');
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('This Image could not be saved. Please try again.');
}
}
}
}
?>
When Я бегу t он приложение и использовать функцию «Добавить» вот что я получаю
Database Error
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'field list'
SQL Query: INSERT INTO `thewoode_virtual_workshop`.`vw_image_tests` (`code`, `description`, `image`, `modified`, `created`, `id`) VALUES ('PKFPBU', 'Vertex Click Pen Bushing', Array, '2015-03-24 10:11:37', '2015-03-24 10:11:37', '55118cb9-81ec-44a2-b69e-391645591f3e')
Трассировка стека
CORE/Cake/Model/Datasource/DboSource.php line 460 → PDOStatement->execute(array)
CORE/Cake/Model/Datasource/DboSource.php line 426 → DboSource->_execute(string, array)
CORE/Cake/Model/Datasource/DboSource.php line 1012 → DboSource->execute(string)
CORE/Cake/Model/Model.php line 1928 → DboSource->create(AppModel, array, array)
CORE/Cake/Model/Model.php line 1751 → Model->_doSave(null, array)
APP/Controller/VwImageTestController.php line 24 → Model->save()
[internal function] → VwImageTestController->add()
CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(VwImageTestController, array)
CORE/Cake/Routing/Dispatcher.php line 193 → Controller->invokeAction(CakeRequest)
CORE/Cake/Routing/Dispatcher.php line 167 → Dispatcher->_invoke(VwImageTestController, CakeRequest)
APP/webroot/index.php line 118 → Dispatcher->dispatch(CakeRequest, CakeResponse)
имеет меня в тупик Спасибо заранее Майк
Не могли бы вы опубликовать свой контроллер 'добавить()' код действия –
Edited включить контроллер –
Mike .. Я до сих пор не вижу код контроллера –