Friday, May 29, 2009

Re: Problem Uploading Flash

Anyone able to help with this?

On May 28, 7:29 am, "Arak Tai'Roth" <nielsen.dus...@gmail.com> wrote:
> So I have a problem uploading a flash video using MeioUpload in
> CakePHP. Here is my controller code for the add function:
>
>                 function add()
>                 {
>                         if (!empty($this->data['Video']))
>                         {
>                                 $mrClean = new Sanitize();
>                                 $id = $this->Session->read('buildId');
>                                 $slug = $this->Session->read('buildSlug');
>
>                                 $this->data['Video']['build_id'] = $id;
>
>                                 if ($this->Video->save($this->data['Video']))
>                                 {
>                                         $this->Session->setFlash('New video for build ' . $slug . ' have
> been added.');
>
>                                         $this->redirect('/builds/view/' . $slug);
>                                         $this->exit();
>                                 }
>                                 else
>                                 {
>                                         $this->Session->setFlash('New video for build ' . $slug . ' could
> not be added.');
>
>                                         $this->redirect('/builds/view/' . $slug);
>                                         $this->exit();
>                                 }
>                         }
>                 }
>
> and the code for the Video model:
>
>         class Video extends AppModel
>         {
>                 var $name = 'Video';
>
>                 var $actsAs = array(
>                         'MeioUpload' => array(
>                                 'video' => array(
>                                         'dir' => 'videos/builds/uploads',
>                                         'create_directory' => false,
>                                         'allowed_mime' => array('video/x-flv'),
>                                         'allowed_ext' => array('.flv')
>                                 )
>                         )
>                 );
>         }
>
> and the code for the add view:
>
> echo $form->create('Video', array('action' => 'add', 'type' =>
> 'file'));
>         echo $form->label('Video.video', 'Video:');
>         echo $form->input('Video.video', array('label' => false, 'type' =>
> 'file'));
>
>         echo $form->submit('background.png');
> echo $form->end();
>
> I've been through this now for the past 2 days and can't figure out
> anything wrong with the code, yet the video will not get uploaded and
> as such the database entry never gets created. I have no idea what the
> problem is so I have no clue what to look for. Is anyone able to help
> me with this?
--~--~---------~--~----~------------~-------~--~----~
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: