XUpload - input fields

Message
Author
jonasuk
Posts: 2
Joined: Jan 22, 2008 12:56 pm

input fields

#1 Postby jonasuk » Jan 22, 2008 1:09 pm

Hi
I would like to know how to extract different input fields that are sent from the upload_form.html page to upload.cgi

I am a newbi to PERL although I know (from c programming in cgi) that I I must get the data from $string=$ENV('QUERY_STRING');

For instance I would like to read the input of the comment box;
your name:<input name="commentxy" ... but can not quite find where in upload.cgi the GETENV is passed.

kind regards
Jonas Lundberg

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Jan 22, 2008 1:40 pm

Code: Select all

my $commentxy = $cg->param('commentxy');

jonasuk
Posts: 2
Joined: Jan 22, 2008 12:56 pm

#3 Postby jonasuk » Jan 25, 2008 5:34 pm

Hi that is great, thanks :)

Just one more question if I may .. I am trying to pass the result of $commentxy to a file for instance and the script halts at this point, the code i would have to do this is

open filesp, ">$dir/test.txt" || die "cannot open file for reading: $!";
print filesp "$commentxy";
close(filesp);

but this code has a problem, probably do to with the expected data that is being printed isnt correct ?

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Jan 28, 2008 11:17 am

The code looks fine. $dir is defined?
You can add

Code: Select all

use CGI::Carp qw(fatalsToBrowser);
to the code to view detailed error in browser.

PS: probably you've already fixed it :)