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

Type file invalid #92

Open
fabiotakaki opened this issue Dec 6, 2011 · 5 comments
Open

Type file invalid #92

fabiotakaki opened this issue Dec 6, 2011 · 5 comments
Labels

Comments

@fabiotakaki
Copy link

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

@rubyistdotjs
Copy link

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'),
        )
    )
);                          

@jrbasso
Copy link
Owner

jrbasso commented Dec 10, 2011

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

@fabiotakaki
Copy link
Author

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',
)
)
);

@rubyistdotjs
Copy link

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.

@fabiotakaki
Copy link
Author

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.

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

No branches or pull requests

3 participants