[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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and I'm trying to get&nbsp;&nbsp; =
</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for any help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#!/usr/bin/perl -w</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>use CGI;&nbsp;&nbsp;&nbsp;<BR>use Carp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>sub bye_bye {<BR>&nbsp;$mes =3D shift;<BR>&nbsp;print=20
"&lt;br&gt;$mes&lt;br&gt;\n";</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;exit;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>print "Content-type: text/html\n\n ";<BR>my $cg =3D new =
CGI();</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>my $save_path =3D "D:\\tmpUL\\";</DIV>
<DIV>&nbsp;</DIV>
<DIV>print &lt;&lt;__TABLE__;<BR>&lt;html&gt;<BR>&lt;body&nbsp;=20
bgcolor=3D"FFFFCC"&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;table border=3D"1" cellpadding=3D"5" width=3D"100%"=20
align=3D"center"&gt;<BR>&lt;tr&gt;&lt;td colspan=3D"2" =
bgcolor=3D"#0066cc"&gt;&lt;font=20
color=3D"#FFFFCC" size=3D"+1" align=3D"center"&gt;Files=20
Uploaded&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;<BR>&lt;tr&nbsp;=20
bgcolor=3D"#ffff00"&gt;&lt;td style=3D"font-size: =
110%;"&gt;&lt;nobr&gt;File=20
Name&lt;/nobr&gt;&lt;/td&gt;<BR>&nbsp;&lt;td style=3D"font-size: =
110%"&nbsp;=20
align=3D"right"&gt;&lt;nobr&gt;File=20
size&lt;/nobr&gt;&lt;/td&gt;&lt;/tr&gt;<BR>__TABLE__</DIV>
<DIV>&nbsp;</DIV>
<DIV>my $size =3D $cg-&gt;param;<BR>for($i=3D0 ; $i &lt; $size ;=20
$i++)<BR>{<BR>&nbsp;$file_upload &nbsp;=3D =
$cg-&gt;param("userfile[$i]");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;if($file_upload) {<BR>&nbsp;&nbsp;my $fh =3D=20
$cg-&gt;upload("userfile[$i]");<BR>&nbsp;&nbsp;my @name =3D=20
split('/',$fh);<BR>&nbsp;&nbsp;my $filename =3D=20
$name[$#name];<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;$fsize =3D(-s=20
$fh);<BR>&nbsp;&nbsp;print "&lt;tr&gt;&lt;td&gt;$filename=20
&lt;/td&gt;\n";<BR>&nbsp;&nbsp;print=20
"&lt;td&gt;$fsize&lt;/td&gt;&lt;/tr&gt;";<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;=
if(defined($save_path))<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;open=20
(OUTFILE,"&gt;&gt;$save_path/$filename");<BR>&nbsp;&nbsp;&nbsp;while(&lt;=
$fh&gt;)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;print OUTFILE=20
$_;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<FONT color=3D#ff0000>### THIS IS WHERE THE ERROR=20
OCCURS</FONT><BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;close(OUTFILE);=
<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nb=
sp;carp=20
'not saving';<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>print &lt;&lt;__TABLE__;<BR>&lt;/table&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;p style=3D"text-align:center; font-size: 80%"&gt;Sample&nbsp; =
Perl Upload=20
handler provided by<BR>&nbsp;&lt;a href=3D"<A=20
href=3D'http://www.radinks.com/?dn">Rad'>http://www.radinks.com/sftp/?dn">Secure'>http://www.radinks.com/s=
ftp/?dn"&gt;Secure</A>=20
FTP Applet&lt;/a&gt; or our<BR>&lt;a href=3D"<A=20
href=3D'http://www.radinks.com/mms/?dn">Multimedia'>http://www.radinks.co=
m/mms/?dn"&gt;Multimedia</A>=20
Messaging Solution&lt;/a&gt;?&lt;/p&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>__TABLE__</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00A7_01C4F9CD.95BB2BA0--