[html-formfu] Uploading using the File element and DBIx::Class::FS

Octavian Râşniţă orasnita at gmail.com
Tue Dec 15 17:55:51 GMT 2009


Hi,

I have tried to upload a file using an HTML::FormFu File element using 
Catalyst::Controller::HTML::FormFu, and DBIx::Class::InflateColumn::FS, 
using:

if ($form->submitted_and_valid) {
$form->model->create;
}

The file is inserted in the database but it is created on the hard disk with 
a size of 0 bytes.

I have also tried to add before ->create:

$form->add_valid({file => $form->param('file')->fh});
$form->process;

and I have also tried to add:

$form->get_element({name => 'file'})->value($form->param('file')->fh);

But it doesn't have any effect.

However, if I use the following syntax, it works fine:

$c->model("DB::Anunturi")->create({
file => $form->param('file')->fh,
});

In this case the file is created correctly on the hard disk.

Is it possible to do just $form->model->create (because I don't want to 
specify each field) and also save the file successfully?

Thanks.

Octavian




More information about the HTML-FormFu mailing list