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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|