added file pile

This commit is contained in:
JT Smith 2004-12-25 16:07:28 +00:00
parent 2e9602e248
commit 27356b09f6
4 changed files with 249 additions and 8 deletions

View file

@ -158,7 +158,7 @@ Grabs an attachment from a form POST and saves it to this storage location.
=head3 formVariableName
Provide the form variable name to which the file being uploaded is assigned.
Provide the form variable name to which the file being uploaded is assigned. Note that if multiple files are uploaded with the same formVariableName then they'll all be stored in the storage location, but only the last filename will be returned. Use the getFiles() method on the storage location to get all the filenames stored.
=cut
@ -166,9 +166,8 @@ sub addFileFromFormPost {
my $self = shift;
my $formVariableName = shift;
return "" if (WebGUI::HTTP::getStatus() =~ /^413/);
my $tempPath = $session{cgi}->upload($formVariableName);
if (defined $tempPath) {
my $filename;
my $filename;
foreach my $tempPath ($session{cgi}->upload($formVariableName)) {
if ($tempPath =~ /([^\/\\]+)$/) {
$filename = $1;
} else {
@ -193,9 +192,8 @@ sub addFileFromFormPost {
$self->_addError("Couldn't open file ".$self->getPath($filename)." for writing due to error: ".$!);
return undef;
}
return $filename;
}
return undef;
return $filename;
}