I tried as you suggested and here's what I have:
my $q = Apache::Request->new($r);
my $uploads = $q->upload;
my @arrayups = $q->upload;
warn "There's an array of scalars: ". scalar @arrayups;
warn "and I have a table ref: ".$uploads;
foreach my $key (keys %{$uploads})
{
warn "Uploader found $key";
my $upload = $uploads->{$key};
warn "Found $upload->filename";
}
and this is what I get:
There's an array of scalars: 24 at (eval 20) line 8.
and I have a table ref: Apache::Upload::Table=HASH(0x8222cdc) at
(eval 20) line 9.
But nothing else as if my foreach finds nothing... What am I
missing? :) I'm looking at last example in the synopsis of:
http://search.cpan.org/~stas/mod_perl-1.99_13/docs/api/APR/Table.pod
also, when I finally do get it (by cheating and calling $q-
>upload('resourceurl') directly) I'm trying to link using this:
my $filename = $upload->filename;
#my $upload_filehandle = $upload->fh;
$filename =~ s/.*[\/\\](.*)/$1/;
warn "filename:". $filename;
my $upload_dir = $sysparms->{uploaddirectory};
my $uploadfile = "$upload_dir/$filename";
warn "There was a problem uploading: $uploadfile" unless $upload-
>link($uploadfile);
Am I on the right track with this? It fails... In another
thread (http://www.gossamer-
threads.com/archive/mod_perl_C1/modperl_F7/File_uploads_using_Apa
che:%3Brequest_in_mod_perl2_P101676), you mention 3 possibilities
as to why it could fail and it implicates a temp directory...
I'm expecting it to write to that file. The $upload_dir exists,
but the file obviously doesn't because I'm trying to upload it...
Do I need to ->bb and then write it?
thanks!
ken.
On 8 Apr 2004 at 10:56, Joe Schaefer wrote:
> "Ken Burcham" <[EMAIL PROTECTED]> writes:
>
> > Ok, I might be on to something...
> >
> > I think the segfault is coming when I call 'upload' with a non-
> > upload field... But since calling 'upload' without a name
> > returns to me a list of variable names that include non-upload
> > fields, iterating through guarantees me to segfault:
> >
> > (NOTE: resourceurl is the only 'file' field on my form with 23
> > other 'text' fields)
> >
> > my $q = Apache::Request->new($r);
> >
> > my @uploads = $q->upload;
>
> OK, I see the problem now. In list context $q->upload()
> is failing to filter out the non-upload keys. It should
> get fixed in the next release, but in the meantime try
> using $q->upload() in scalar context. That will give you
> an Apache::Upload::Table (@ISA=APR::Table) to work with.
> The table will only contain uploads, and since it's a
> tied hash, you can iterate over it using keys() or each().
>
> --
> Joe Schaefer
>
>
> --
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
--
Ken Burcham
Ken Burcham Consulting, Inc.
http://www.capemaystation.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html