Hi folks:

I am trying to set up a simple multiple upload form. Using jQuery multi class for the interface portion. The form looks like this:

   <form action="/upload" class="multi" enctype="multipart/form-data" >
    <input type="file" class="multi" />
    <input type="submit" name="upload" value="upload file(s)" />
<input type="hidden" name="destination_path" value="<% $destination_path %>" />
    <input type="hidden" name="form_submit" value="yes" />
   </form>

and the receiving action is basically a cut and paste from the cookbook

  my $path      = $c->req->param('destination_path');
  $c->log->debug('********* path = '.$path);
  if ( $c->request->parameters->{form_submit} eq 'yes' ) {
      $c->log->debug('********* uploading! ');
      for my $field ( $c->request->upload  ) {
          $c->log->debug('*********** field '.$field);
          my $upload   = $c->request->upload($field);
          my $filename = $upload->filename;
          my $target   = File::Spec->catfile($path,$filename);
          $c->log->debug('*********** name  '.$filename);
          $c->log->debug('*********** target'.$target);

unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
              die( "Failed to copy '$filename' to '$target': $!" );
          }
      }
  }

Now when I try to upload a file, in this case a simple perl script named wireless.pl ... fairly small as a simple test case, the controller reports

[debug] Query Parameters are:
.-------------------------------------+--------------------------------------.
| Parameter | Value |
+-------------------------------------+--------------------------------------+
| destination_path | /tmp | | file | wireless.pl | | file1 | | | form_submit | yes | | upload | upload file(s) |
'-------------------------------------+--------------------------------------'
[debug] "GET" request for "upload" from "127.0.0.1"
[debug] Path is "upload"
[debug] ********* path = /tmp
[debug] ********* uploading!
[debug] ********* dump = $VAR1 = 'upload file(s)';

but it never seems to hit the innards of the loop. So it doesn't actually go through extracting the file name and so on.

Any clues?  Is it obvious what I am doing wrong here?

And if there is a better way to do multi file upload using Catalyst and jQuery, please, by all means, I am all ears ...

Thanks!

--
Joe Landman
[EMAIL PROTECTED]

_______________________________________________
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