[Xitami] Folder permission issue or PERL error???
Admin (MRJ)
xitami@lists.xitami.org
Fri, 14 Jan 2005 00:11:24 -0700
This is a multi-part message in MIME format.
------=_NextPart_000_00A7_01C4F9CD.95BB2BA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am having a bit of trouble here.
I have ActivePerl 5.8.6 installed
Xitami 2.5c2 installed on Win 2k
and I'm trying to get http://www.radinks.com/upload/
this little thing to work in the lite edition free version.
Now everything is ok as long I try using the html-perl.htm file to do an =
upload but=20
it fails stating there is a error on line 62 in the upload.cgi file.
the following is the CGI file I am using.
Any hints as to why it won't upload to my xitami box?
I really don't know any Perl myself to debug this thing in a proper =
manner.
Thanks for any help.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/usr/bin/perl -w
#
# Perl script to accept file uploads. This script is provided for =
demonstration=20
# purposes only.
# you need to have the CGI module installed.
#
# Copyright Rad Inks (pvt) 2003
# http://www.radinks.com
use CGI; =20
use Carp;
sub bye_bye {
$mes =3D shift;
print "<br>$mes<br>\n";
exit;
}
print "Content-type: text/html\n\n ";
my $cg =3D new CGI();
#
# Files will not be saved if $save_path is left undefined. Please make =
sure
# the path you choose is writable.
#
my $save_path =3D "D:\\tmpUL\\";
print <<__TABLE__;
<html>
<body bgcolor=3D"FFFFCC">
<table border=3D"1" cellpadding=3D"5" width=3D"100%" align=3D"center">
<tr><td colspan=3D"2" bgcolor=3D"#0066cc"><font color=3D"#FFFFCC" =
size=3D"+1" align=3D"center">Files Uploaded</font></td></tr>
<tr bgcolor=3D"#ffff00"><td style=3D"font-size: 110%;"><nobr>File =
Name</nobr></td>
<td style=3D"font-size: 110%" align=3D"right"><nobr>File =
size</nobr></td></tr>
__TABLE__
my $size =3D $cg->param;
for($i=3D0 ; $i < $size ; $i++)
{
$file_upload =3D $cg->param("userfile[$i]");
if($file_upload) {
my $fh =3D $cg->upload("userfile[$i]");
my @name =3D split('/',$fh);
my $filename =3D $name[$#name];
=20
$fsize =3D(-s $fh);
print "<tr><td>$filename </td>\n";
print "<td>$fsize</td></tr>";
=20
if(defined($save_path))
{
open (OUTFILE,">>$save_path/$filename");
while(<$fh>) {
print OUTFILE $_; =
### THIS IS WHERE THE ERROR OCCURS
}
close(OUTFILE);
}
else
{
carp 'not saving';
}
}
}
print <<__TABLE__;
</table>
<p style=3D"text-align:center; font-size: 80%">Sample Perl Upload =
handler provided by
<a href=3D"http://www.radinks.com/?dn">Rad Inks</a></p>
=20
<p style=3D"text-align:center; font-size: 80%">have you seen our <a =
href=3D"http://www.radinks.com/sftp/?dn">Secure FTP Applet</a> or our
<a href=3D"http://www.radinks.com/mms/?dn">Multimedia Messaging =
Solution</a>?</p>
__TABLE__
------=_NextPart_000_00A7_01C4F9CD.95BB2BA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I am having a bit of trouble =
here.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have ActivePerl 5.8.6 =
installed</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Xitami 2.5c2 installed on Win =
2k</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>and I'm trying to get =
</FONT><A=20
href=3D"http://www.radinks.com/upload/"><FONT face=3DArial=20
size=3D2>http://www.radinks.com/upload/</FONT></A></DIV>
<DIV><FONT face=3DArial size=3D2>this little thing to work in the lite =
edition free=20
version.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Now everything is ok as long I try =
using the=20
html-perl.htm file to do an upload but </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it fails stating there is a error on =
line 62 in the=20
upload.cgi file.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>the following is the CGI file I am=20
using.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Any hints as to why it won't upload to =
my xitami=20
box?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I really don't know any Perl myself to =
debug this=20
thing in a proper manner.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for any help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV>=
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>#!/usr/bin/perl -w</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>#<BR># Perl script to accept file =
uploads. This=20
script is provided for demonstration <BR># purposes only.<BR># you need =
to have=20
the CGI module installed.<BR>#<BR># Copyright Rad Inks (pvt) 2003<BR># =
<A=20
href=3D"http://www.radinks.com">http://www.radinks.com</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>use CGI; <BR>use Carp;</DIV>
<DIV> </DIV>
<DIV>sub bye_bye {<BR> $mes =3D shift;<BR> print=20
"<br>$mes<br>\n";</DIV>
<DIV> </DIV>
<DIV> exit;<BR>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>print "Content-type: text/html\n\n ";<BR>my $cg =3D new =
CGI();</DIV>
<DIV> </DIV>
<DIV>#<BR># Files will not be saved if $save_path is left undefined. =
Please make=20
sure<BR># the path you choose is writable.<BR>#</DIV>
<DIV> </DIV>
<DIV>my $save_path =3D "D:\\tmpUL\\";</DIV>
<DIV> </DIV>
<DIV>print <<__TABLE__;<BR><html><BR><body =20
bgcolor=3D"FFFFCC"></DIV>
<DIV> </DIV>
<DIV><table border=3D"1" cellpadding=3D"5" width=3D"100%"=20
align=3D"center"><BR><tr><td colspan=3D"2" =
bgcolor=3D"#0066cc"><font=20
color=3D"#FFFFCC" size=3D"+1" align=3D"center">Files=20
Uploaded</font></td></tr><BR><tr =20
bgcolor=3D"#ffff00"><td style=3D"font-size: =
110%;"><nobr>File=20
Name</nobr></td><BR> <td style=3D"font-size: =
110%" =20
align=3D"right"><nobr>File=20
size</nobr></td></tr><BR>__TABLE__</DIV>
<DIV> </DIV>
<DIV>my $size =3D $cg->param;<BR>for($i=3D0 ; $i < $size ;=20
$i++)<BR>{<BR> $file_upload =3D =
$cg->param("userfile[$i]");</DIV>
<DIV> </DIV>
<DIV> if($file_upload) {<BR> my $fh =3D=20
$cg->upload("userfile[$i]");<BR> my @name =3D=20
split('/',$fh);<BR> my $filename =3D=20
$name[$#name];<BR> <BR> $fsize =3D(-s=20
$fh);<BR> print "<tr><td>$filename=20
</td>\n";<BR> print=20
"<td>$fsize</td></tr>";<BR> <BR> =
if(defined($save_path))<BR> {<BR> open=20
(OUTFILE,">>$save_path/$filename");<BR> while(<=
$fh>)=20
{<BR> print OUTFILE=20
$_; &nbs=
p;  =
; =
&=
nbsp; &n=
bsp; =20
<FONT color=3D#ff0000>### THIS IS WHERE THE ERROR=20
OCCURS</FONT><BR> }<BR> close(OUTFILE);=
<BR> }<BR> else<BR> {<BR> &nb=
sp;carp=20
'not saving';<BR> }<BR> }<BR>}</DIV>
<DIV> </DIV>
<DIV><BR>print <<__TABLE__;<BR></table></DIV>
<DIV> </DIV>
<DIV><p style=3D"text-align:center; font-size: 80%">Sample =
Perl Upload=20
handler provided by<BR> <a href=3D"<A=20
href=3D'http://www.radinks.com/?dn">Rad'>http://www.radinks.com/?dn">R=
ad</A>=20
Inks</a></p><BR> <BR><p style=3D"text-align:center; =
font-size:=20
80%">have you seen our <a href=3D"<A=20
href=3D'http://www.radinks.com/sftp/?dn">Secure'>http://www.radinks.com/s=
ftp/?dn">Secure</A>=20
FTP Applet</a> or our<BR><a href=3D"<A=20
href=3D'http://www.radinks.com/mms/?dn">Multimedia'>http://www.radinks.co=
m/mms/?dn">Multimedia</A>=20
Messaging Solution</a>?</p></DIV>
<DIV> </DIV>
<DIV>__TABLE__</DIV>
<DIV> </DIV>
<DIV><BR></FONT> </DIV></BODY></HTML>
------=_NextPart_000_00A7_01C4F9CD.95BB2BA0--