Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

multipart/form under mod_perl

by philou (Beadle)
on Feb 04, 2002 at 08:49 UTC ( [id://143185]=perlquestion: print w/replies, xml ) Need Help??

philou has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I need to upload files to my server (Apache+mod_perl), and am looking for a mod_perl method to handle multipart/form data within my perl handler.
I would prefer not to use the upload methods of CGI, and use some mod_perl specific methods for that task, but I have not been able to find out some appropriate way to do that (apart from reading directly from the socket).
Does anybody has some tips about that ?
Thanks

philou

Replies are listed 'Best First'.
Re: multipart/form under mod_perl
by gellyfish (Monsignor) on Feb 04, 2002 at 09:59 UTC

    I would recommend that you take a look at the Apache::Request module - it has a similar interface to that of the CGI module but works directly with the Apache API.

    You will get some code like this :

    use Apache::Request; sub handler { my ( $request ) = @_; my $apr = Apache::Request->new($request); my $upload = $apr->upload; my $fh = $upload->fh; while(<$fh>) { # do something with file contents } }

    /J\

      Thanks man,
      I thought the Apache::Request was bundled with mod_perl, but the fact is that I was actually using the basic request object provided by mod_perl.
      That Apache::Request seems to have all the features I have ever dreamed of (some of them I had to write them by myself).
      philou

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://143185]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found