jrbasso/MeioUpload

Type file invalid

fabiotakaki opened this issue · 5 comments

I configured right in my cakephp 2.0
Files in the Plugin paste, configuration in the Model correct, added for load my Plugin in the Model.
But, when i upload one image, don't save my image, and show me that file is invalid.
I don't know why, I just try install sometimes again, but don't work.
help me please.
thanks

I don't know where you got the documentation, how did you declare your Mime types ?
Before the key was 'allowed_mime' but now it's 'allowedMime'.

public $actsAs = array(
    'MeioUpload.MeioUpload' => array(
        'file' => array(
            'allowedMime' => array('application/pdf', 'application/zip'),
            'allowedExt' => array('.pdf', '.zip'),
        )
    )
);                          

Maybe the problem was related with the bug #93. Check with the latest version in master branch to see if works.

Yes, I have the latest version in my app, my Model is this:

var $actsAs = array(
'MeioUpload.MeioUpload' => array(
'picture' => array(
'dir' => 'img{DS}{model}{DS}{field}',
'create_directory' => true,
'allowed_mime' => array('image/jpeg', 'image/pjpeg', 'image/png'),
'allowed_ext' => array('.jpg', '.jpeg', '.png'),
'thumbsizes' => array(
'normal' => array('width'=>200, 'height'=>200),
),
'default' => 'default.jpg',
)
)
);

This is exactly what I said, you must replace "allowed_mime" by "allowedMime", "allowed_ext" by "allowedExt", "create_directory" by "createDirectory", ...

And replace in "dir", {model} by {ModelName} and {field} by {fieldName}.

You can see the whole syntax and options in MeioUpload behavior between line 33 and 68.

Oh, thanks for help me. I replace, and my model stay:
var $actsAs = array(
'MeioUpload.MeioUpload' => array(
'picture' => array(
'dir' => 'img{DS}{ModelName}{DS}{fieldName}',
'createDirectory' => true,
'allowedMime' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/gif', 'image/bmp', 'image/x-icon', 'image/vnd.microsoft.icon'),
'allowedExt' => array('.jpg', '.jpeg', '.png', '.gif', '.bmp', '.ico'),
'thumbsizes' => array(
'normal' => array('width'=>200, 'height'=>200),
),
'default' => 'default.jpg',
)
)
);

The problem when I add one post, the field picture say for me: "Invalid type file"
And I try upload jpg, png.. and don't work..
Thanks for your attention for me.