this is my first try at this, i read a tut and this is what i came up with, but its not working, did i forget something?
Code:
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
$filename = $query->param("photo");
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("photo");
if ($filename ne ""){
open UPLOADFILE, "> picts/$filename";
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
print $query->header ( );
print <<END_HTML;
Content-Type: text/html\n\n
<HEAD>
<TITLE>Thanks!</TITLE>
</HEAD>
<BODY>
<P>Thanks for uploading your photo!</P>
<P>Your photo:</P>
<img src="picts/$filename" border="0">
</BODY>
</HTML>
END_HTML
} else {
print <<END_HTML;
Content-Type: text/html\n\n
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Up^Loader</title>
<style>
<!--
td { font-family : verdana,sans-serif; font-size : 13px; }
td.tableOutline1 { background : #9BA7B3; }
tr { font-family : verdana,sans-serif; font-size : 13px; }
tr.tableBody2 { background : #DEEFFF; }
tr.tableHead3 { background : #DEEFFF; }
td.tableHead1 { background : #FFF9DE; }
tr.tableBody1 { background : #F6F6F3; }
tr.tableHead2 { background : #FFF9DE; }
body {
scrollbar-3dlight-color : #000000;
scrollbar-highlight-color : #F7F7F7;
scrollbar-darkshadow-color : #000000;
scrollbar-shadow-color : #F7F7F7;
scrollbar-face-color : #F7F7F7;
scrollbar-arrow-color : #000000;
scrollbar-track-color : #F7F7F7;
}
.texta4 {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
padding-left: 3px;
padding-top: 1px;
padding-right: 1px;
background: ;
color: Black;
background-color: #F3F3F3;
border: 1px solid #000000;
font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFEF4">
<div align="center">
<table cellpadding="0" cellspacing="0" width="75%" border="1%" bordercolor="#9BA7B3" style="border-style: solid" bordercolorlight="#9BA7B3" bordercolordark="#FFFEF4">
<!-- MSTableType="layout" -->
<tr>
<td height="173" bgcolor="#F6F6F3">
<div align="center">
<table cellpadding="2" cellspacing="0" width="100%" bgcolor="#DEEFFF">
<!-- MSTableType="layout" -->
<tr>
<td height="15" valign="top"><b>File Up^Loader</b></td>
</tr>
</table>
<form method="POST" enctype="multipart/form-data">
<p align="left" style="margin-top: 4px; margin-bottom: 0">
File You wish to upload:</p>
<p style="margin-top: 4px; margin-bottom: 0">
<input type="file" name="photo" size="32" class="texta4"></p>
<p>
<input type="submit" value="Up ^ Load" name="B1" class="texta4"></p>
<p> </p>
</form></div>
</td>
</tr>
</table>
</div>
</BODY>
END_HTML
}