Multiple File Uploads: $r or %ARGS? Hey folks. I'm new here, and this is my first post.
I'm trying to figure out a way to manage multiple file uploads. I have a form that allows users to upload arbitrary numbers of files, which I then need to process and save on the server. I have a javascript that allows this arbitrary number of files: by clicking a link, you create a new form field that adds a numeral to the end of the field name. The %ARGS hash looks like this for a single file: file => 273141 title => Back to id => 7 number => 1 creation_date => 2007 A multiple upload %ARGS looks like this: file => 273141 title => Back to id => 7 number => 1 creation_date => 2007 file-2 => that'shot8 title-2 => Natural id-2 => 6 number-2 => 2 creation_date-2 => 1985 file-3 => Introduction title-3 => Stuff Like This id-3 => 12 number-3 => 3 creation_date-3 => 1998 I created a loop that allows me to handle the %ARGS data: my $i = 2; while ( $i <= $ARGS{'numberfiles'} ) { my %thash; foreach my $key ( sort( keys %ARGS ) ) { if ( $key =~ /creation_date-$i/ ) { $thash{'creation_date'} = $ARGS{$key}; } if ( $key =~ /title-$i/ ) { $thash{'title'} = $ARGS{$key}; } if ( $key =~ /number-$i/ ) { $thash{'number'} = $ARGS{$key}; } if ( $key =~ /rate-$i/ ) { $thash{'rate'} = $ARGS{$key}; } if ( $key =~ /type-$i/ ) { $thash{'type'} = $ARGS{$key}; } if ( $key =~ /id-$i/ ) { $thash{'id'} = $ARGS{$key}; } if ( $key =~ /file-$i/ ) { $thash{'file'} = $ARGS{$key}; } } my $nfile = $api->newBean('file'); } $nfile->save($api); $i++; } But the problem is handling the actual files simultaneous with this file information. I have been trying to construct some sort of loop to go through each $r->upload->tempname object, but it seems like the only way to do that is to make it an entirely separate loop. Which gets kludgier and kludgier, because my object-oriented perl requires that I make a "mini hash" out of every file uploaded--the %thash above. I know there has to be an elegant way to do this: I just don't know it. Is it possible to use the Apache::Request object instead of %ARGS altogether? Could I handle the file data and the files together using $r instead of taking the info from %ARGS here and trying to take the data from $r there? Has anyone been faced with this problem before? All comments and help, insights and wisdom, would be greatly appreciated. Amiri ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users