By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

How to parse a multipart form in CGI/PERL?

P: 2
Im trying to parse form data from a form that has an input type: file, which requires a multipart encode. The form also has other input text boxes, the names of which are populated on the fly so the names of the text boxes are unknown to hard code into the script that parses the form. Most of the research I've done on how to parse multipart forms suggests to use a format such as the following:

$mycgi = new CGI;
print $mycgi->header;

# get the file from the input stream
$upload = $mycgi->param("UPLOAD");

Is it possible for me to get the names and values of the unknown text fields with this type of parsing? If so, how? Thanks for any assitance in advance
Nov 16 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 971
You could use the following.

Expand|Select|Wrap|Line Numbers
  1. my %params = $q->Vars;
  3. while (my ($key, $value) = each %params) {
  4.     print "Key: $key\tValue: $value\n";
  5. }
Nov 16 '08 #2

P: 2
The Vars method is exactly what I was looking for, tyvm Kevin helped me tremedously.
Nov 16 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.