Tuesday, February 24, 2009

Re: Automagic File Upload Component

Nevermind, I moved the action to admin_add and forgot to add 'type' =>
'file' to the form create in the admin_add.ctp.

Sorry for the noise.

On Feb 24, 9:30 am, dogenpunk <dogenp...@gmail.com> wrote:
> Hi,
> I'm using Nick Baker's FileUpload component (http://bakery.cakephp.org/
> articles/view/file-upload-component-w-automagic-model-optional) and am
> running into some weird issue. I have two models, Pictures and
> Uploads. Uploads belongs to Pictures (FK: picture_id). In the Picture
> add view I have a file field named Upload.file. When the user submits
> this form I receive an error from the FileUpload component:
>
>  FileUpload::_checkType() s is not in the allowedTypes array.
> The file name that was uploaded was scarlett.jpg.
>
> When uploading batgirl.jpg the error reads:
> FileUpload::_checkType() b is not in the allowedTypes array.
>
>   function _checkType(){
>     foreach($this->allowedTypes as $value){
>       if(strtolower($this->uploadedFile['type']) == strtolower($value))
> {
>         return true;
>       }
>     }
>     $this->_error("FileUpload::_checkType() {$this->uploadedFile
> ['type']} is not in the allowedTypes array.");
>     return false;
>   }
>
>   var $allowedTypes = array(
>     'image/jpeg',
>     'image/gif',
>     'image/png',
>     'image/pjpeg',
>     'image/x-png'
>   );
>
> Does anyone have an idea why the file type is not getting set
> properly? I thought that this was set by Apache. I checked and the
> jpeg, gif and png MIME types are all setup. Any ideas?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: