Hey Everyone,
   Okay, potentially stupid question, but, here goes :)

I am using Catalyst::Controller::FormBuilder, and I am trying to grab the file from inside using the Request::Upload, yet it never gets any uploads .. does C::C::FormBuilder and Request::Upload 'play nicely' with each other ?

   Here is my Yaml Form;

name: media_create
method: post
enctype: 'multipart/form-data'
fields:
  myUploadFile:
    label: Filename
    type:  file
    required: 1

submit: Upload New Media

   And here is the controller in my media create;

package MyApp::Controller::Media;

use strict;
use warnings;
#use base 'Catalyst::Controller';
use base 'Catalyst::Controller::FormBuilder';
use Data::Dumper;
use CGI::FormBuilder;
sub create : Local Form {
    my ( $self, $c, @args ) = @_;

    my $form = $self->formbuilder;

    if ( $form->submitted ) {
      if ( $form->validate ) {
                my $upload = $c->request->upload('myUploadFile');
                $upload->copy_to('/tmp/blah');
                print $upload->md5sum;

$c->stash->{notice_msg} = "New Media Created";
                return $c->forward('/media/create');
        }
    }
else { $c->stash->{error_msg} = "INVALID FORM"; $c->stash->{invalid_fields} = [ grep { !$_->validate } $form->fields ];
    }
    $c->stash->{template} = 'media/create.tt2';
}

   Regards
   Stef

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to