Joe: Thanks so much for taking the time to answer...

I'll look into the segfault backtrace next...

When I do this:

 my $q = Apache::Request->new($r);
 my @uploads = $q->upload;

 warn 'Number of uploads: '. scalar @uploads;

 foreach my $uploadfilename (@$uploads)
 {
    #my $upload = $q->upload($uploadfilename); #SEGFAULTS!
    warn "UPLOADER found " . $uploadfilename;
 }

I get "Number of uploads: 24" which is the number of fields on my 
multipart html form of which only one is a "file" type:

<form action="/input" method="POST" enctype="multipart/form-data" 
name="resourceform" parent="resourceform">
...
<tr>
<td><label for="effectivedate">effective date</label></td>
    <td><input type="text" name="effectivedate" value="" 
length="" max=""></td>
</tr>
    <br><tr>
<td><label for="expirationdate">expiration date</label></td>
    <td><input type="text" name="expirationdate" value="" 
length="" max=""></td>
</tr>
    <br><tr>
<td><label for="modby">moderated by</label></td>
    <td><input type="text" name="modby" value="" length="" 
max=""></td>
</tr>
    <br><tr>
<td><label for="resourceurl">resource url</label></td>
    <td><input type="file" name="resourceurl" value="" length="" 
max=""></td>
</tr>
...
</form>

In my apache error log I see:

...
UPLOADER found effectivedate  at (eval 20) line 14.
UPLOADER found expirationdate  at (eval 20) line 14.
UPLOADER found modby  at (eval 20) line 14.
UPLOADER found resourceurl  at (eval 20) line 14.
...


So it looks to me like EVERY field gets dumped into the upload 
array...  Like I said, I'm probably doing something stupid...  

I'll look into the backtrace now...

THANKS so much!

ken.




On 8 Apr 2004 at 9:18, Joe Schaefer wrote:

> "Ken Burcham" <[EMAIL PROTECTED]> writes:
> 
> > > That's certainly supposed to work, assuming 'somefilename' is
> > > the name of the upload widget in your HTML form. Can you post 
> > > a backtrace for the segfault?
> > 
> > Sure... umm... how do I do that?  :)
> > 
> > I'm still pretty new to perl.  
> 
> Segfaults arise from buggy C code. For instructions on generating
> a backtrace, read
> 
>   http://perl.apache.org/docs/2.0/user/help/help.html#Resolving_Segmentation_Faults
> 
> > > 
> > > That is correct.  In apache1 the uploads formed a linked list
> > > internally, but that's no longer true in apreq2. In apreq2 
> > > $req->upload follows the same interface pattern as $req->param.
> > 
> > How do I get to just the upload items?  Or do I test via $upload-
> > >info/type?
> 
> 
>   No need to test anything: $req->upload() works just like 
> $req->param(), but it is restricted to uploads only.  For example
> 
>   my $upload_table_ref = $req->upload; # APR::Table ref of uploads
> 
>   foreach my $name (keys %$upload_table_ref) {
>      my @uploads = $req->upload($name); # Array of Apache::Upload
>                                         # objects having name = $name
>      # do something with @uploads
>   }
> 
> -- 
> 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


------- End of forwarded message --------- 
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

Reply via email to