
Sassy
Deleted
Mar 21, 2000, 6:32 AM
Post #5 of 6
(541 views)
|
|
Re: Can't Open File From CGI Script
[In reply to]
|
Can't Post
|
|
Believe it or not, in 15 years of software engineering, I've never interacted with a user group so I don't know if you can attach files. It's a short script so here it is: #!/usr/local/bin/perl # This is a test script for InfiNET which parses the form and creates an output file. if ($ENV{'REQUEST_METHOD'} eq 'POST') { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); # Load the FORM variables foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # Open up the output file and make it comma delimited open(OUTFILE, '>outfile.txt'); print OUTFILE "\"$FORM{name}\","; print OUTFILE "\"$FORM{title}\","; print OUTFILE "\"$FORM{h_phone}\","; print OUTFILE "\"$FORM{w_phone}\","; print OUTFILE "\"$FORM{email}\","; print OUTFILE "\"$FORM{sunsign}\","; print OUTFILE "\"$FORM{comments}\" "; close (OUTFILE); } There was actually a little extra code that checked fields, but I removed it for simplicity sake. I really appreciate the help! - Sassy
|