Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Re: CGI Uploading (repost)

by chromatic (Archbishop)
on Apr 17, 2003 at 05:58 UTC ( [id://251137]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: CGI Uploading (repost)
in thread CGI Uploading (repost)

$filename comes from just a few lines earlier in the documentation. Of course, a few lines later, the docs suggest this code instead:

use CGI; my $query = CGI->new(); my $fh = $query->upload('uploaded_file'); while (<$fh>) { print; }

Assuming you've created a form that posts to the script correctly, uses the POST method, uses multipart/form-data encoding, and contains a file upload field named uploaded_file, this will work for you.

Replies are listed 'Best First'.
Re: Re: Re: Re: CGI Uploading (repost)
by Anonymous Monk on Apr 17, 2003 at 06:26 UTC
    Ok, with your example... $fh is actually the name of the file it's going to be saved as on the server, right? So doing a while (<$fh>) it's opening up a blank file then saving the contents stored in the buffer? Sorry, I just don't understand how the uploading actually works. I always imagined it upload the file directly from their system, but it looks like that's not the case.

    Other question..Can I set $fh to $fh = param('uploaded_file') or would that be something different?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-29 05:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found