I'm having a problem with getting the plugin to store the filename in the database. It uploads the file just fine, but never saves the filename. My table looks like this:
CREATE TABLE crochet_items_files (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
crochet_item_id int(11) NOT NULL,
title varchar(255) NOT NULL,
filename varchar(255) NOT NULL,
mimetype varchar(255) DEFAULT NULL,
filesize int(11) DEFAULT NULL,
created datetime DEFAULT NULL,
modified datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
and my model actsAs statement looks like this:
var $actsAs = array(
'FileUpload.FileUpload' => array(
'uploadDir' => 'uploads/crochet_item/files',
'fileVar' => 'filename',
'allowedTypes' => array(
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'gif' => array('image/gif'),
'png' => array('image/png'),
'txt' => array('text/plain'),
'pdf' => array('application/pdf'),
'doc' => array('application/msword')
),
'fields' => array('name' => 'filename', 'type' => 'mimetype', 'size' => 'filesize'),
'required' => false,
'unique' => true,
'fileNameFunction' => false
)
);
By the way, will FileUpload also save the directory path? I didn't see that among the options.
I'm having a problem with getting the plugin to store the filename in the database. It uploads the file just fine, but never saves the filename. My table looks like this:
CREATE TABLE
crochet_items_files(idint(11) unsigned NOT NULL AUTO_INCREMENT,crochet_item_idint(11) NOT NULL,titlevarchar(255) NOT NULL,filenamevarchar(255) NOT NULL,mimetypevarchar(255) DEFAULT NULL,filesizeint(11) DEFAULT NULL,createddatetime DEFAULT NULL,modifieddatetime DEFAULT NULL,PRIMARY KEY (
id)) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
and my model actsAs statement looks like this:
By the way, will FileUpload also save the directory path? I didn't see that among the options.