Closed deanezra closed 11 years ago
You don't need to define all those setting since default are provided.
What version of Cake and the Uploader are you using? Does your form and input have type = file?
Version of uploader is: 4.1.0 (installed via composer) Version of cakephp is: 2.3.2
My view (/view/Fleets/add.ctp) has the following form with csvfilename input which links to the upload behaviour:
<?php echo $this->Form->create('Fleet', array('type' => 'file')); // Other inputs echo $this->Form->input('date');
echo $this->Form->input('csvfilename', array('type' => 'file')); echo $this->Form->end('Submit'); ?>
Aha, if I reduce the behaviour definition to the following, it works:
public $actsAs = array( 'Uploader.Attachment' => array( 'csvfilename' => array( 'overwrite' => false, 'stopSave' => true, 'allowEmpty' => false ) ) );
Not sure why, but I am happy! Thanks for the help.
Yeah, that's weird that it works when you remove some settings. I'll do some testing and figure it out.
Figured it out was the empty dbColumn field.
Thanks for digging into this more. Really impressed with your plugin. very useful
On 29 May 2013 21:11, Miles Johnson notifications@github.com wrote:
Figured it out was the empty dbColumn field.
— Reply to this email directly or view it on GitHubhttps://github.com/milesj/Uploader/issues/116#issuecomment-18642721 .
Dean Ezra Email: dean@deanezra.com
Please forgive me if I am missing a step, but I have followed your steps shown here:
http://milesj.me/code/cakephp/uploader
I have a column called csvfilename of type text in mysql fleets table which is added as a behaviour in my Fleets model:
public $actsAs = array( 'Uploader.Attachment' => array( 'csvfilename' => array( 'nameCallback' => '', 'append' => '', 'prepend' => '', 'tempDir' => TMP, 'uploadDir' => '', 'finalPath' => '', 'dbColumn' => '', 'metaColumns' => array(), 'defaultPath' => '', 'overwrite' => false, 'stopSave' => true, 'allowEmpty' => true, 'transforms' => array(), 'transport' => array() ) ) );
However I am getting the following error from cakephp upon pressing the submit on the form after selecting a file to upload:
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'field list'
SQL Query: INSERT INTO
evemineit
.fleets
(date
,csvfilename
,modified
,created
) VALUES ('2013-05-28 21:44:00', Array, '2013-05-28 21:44:47', '2013-05-28 21:44:47')Shouldn't the 'array' value be the filename of the upload?