4
490
Hi all,
I have made an PerlEx code that uploads text file and writes it on the
screen (HTML page).
Here is the code:
<%
#!/usr/bin/perl -w
use CGI qw
standard);
my $cgi = CGI->new();
my $filename = $cgi->param('filename');
print $filename . "<br />";
my $filehandle = $cgi->upload('filename');
# Wite file to HTML page
while (<$filehandle>)
{
print $_ . '<br />';
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Upload text file</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-8-i" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="filename" id="filename" />
<input type="submit" />
</form>
</body>
</html>
# End of PerlEx code
The problem is that this code works some times and some times does not
work (using the exact same code with the same text file).
Any body have an idea why this happens and how to fix it?
Thanks a lot,
Ari
I have made an PerlEx code that uploads text file and writes it on the
screen (HTML page).
Here is the code:
<%
#!/usr/bin/perl -w
use CGI qw
my $cgi = CGI->new();
my $filename = $cgi->param('filename');
print $filename . "<br />";
my $filehandle = $cgi->upload('filename');
# Wite file to HTML page
while (<$filehandle>)
{
print $_ . '<br />';
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Upload text file</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-8-i" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="filename" id="filename" />
<input type="submit" />
</form>
</body>
</html>
# End of PerlEx code
The problem is that this code works some times and some times does not
work (using the exact same code with the same text file).
Any body have an idea why this happens and how to fix it?
Thanks a lot,
Ari