Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: why do CGI's mess everything up???

by earthboundmisfit (Chaplain)
on Dec 12, 2002 at 15:28 UTC ( #219340=note: print w/replies, xml ) Need Help??

in reply to why do CGI's mess everything up???

Just a guess, but are you using this script on a Windows box? Some browsers insert "\r" as the newline for uploaded data and this subsequently messes up homegrown parsing routines. The way I've gotten around this is to filter for "\r" when saving the data. Here's a sub from a script I'm working on. I'm still working out the taint checking and have a ways to go, but perhaps this will help you out despite still being in its infancy:
sub write_file() { my $filehandle = shift; my $type = uploadInfo($filehandle)->{'Content-Type'}; die "text files only at this point" unless ($type eq 'text/plain' or +$type eq 'text/html'); print "file: $filehandle of type $type\n\n <PRE>"; open (FH, ">d:/inetpub/wwwroot/repnet/docs/$filehandle") or die "cannot create file: $!"; while (<$filehandle>) { $_ =~ s/\r//g; print; print FH; } print "</PRE>"; close(FH); }
---- I am what I read

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2022-08-08 20:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found