fix for file uploading problems in File, Image, FilePile, Graphics (font) and FormHelper

This commit is contained in:
Colin Kuskie 2007-02-16 22:31:53 +00:00
parent 6c8e840fe6
commit ab6d0d2ce6
7 changed files with 28 additions and 6 deletions

View file

@ -247,7 +247,11 @@ sub processPropertiesFromFormPost {
$self->SUPER::processPropertiesFromFormPost;
delete $self->{_storageLocation};
my $storage = $self->getStorageLocation;
my $filename = $storage->addFileFromFormPost("file",1);
##The file form element adds a _file to each input name.
##This thing should really try to use the whole Form API, but that's a major
##change to this Asset
my $filename = $storage->addFileFromFormPost("file_file",1);
$storage->setPrivileges($self->get('ownerUserId'), $self->get('groupIdView'), $self->get('groupIdEdit'));
if (defined $filename && $filename ne $self->get("filename")) {
my %data;

View file

@ -137,7 +137,10 @@ sub edit {
sub editSave {
my $self = shift;
my $tempStorage = WebGUI::Storage->create($self->session);
$tempStorage->addFileFromFormPost("file");
##This is a hack. File uploads should go through the WebGUI::Form::File API
$tempStorage->addFileFromFormPost("file_file");
foreach my $filename (@{$tempStorage->getFiles}) {
my $storage = WebGUI::Storage::Image->create($self->session);
$storage->addFileFromFilesystem($tempStorage->getPath($filename));

View file

@ -697,7 +697,11 @@ sub www_editListingSave {
$storage = WebGUI::Storage::Image->create($self->session);
$data{storageId} = $storage->getId;
}
my $screenshot = $storage->addFileFromFormPost("screenshot");
##This is a hack. File upload should go throught the WebGUI::Form::File API
##so that future changes don't affect us like this
my $screenshot = $storage->addFileFromFormPost("screenshot_file");
if (defined $screenshot) {
$data{filename} = $screenshot;
$storage->generateThumbnail($screenshot);