Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not storing filename #3

Open
larry-tx opened this issue Jul 12, 2010 · 0 comments
Open

Not storing filename #3

larry-tx opened this issue Jul 12, 2010 · 0 comments

Comments

@larry-tx
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant