Hi,



I am very new to all this and have recently set up a website using Webplus X5 and justhost as the web host. On the website I have included a form for clients to include their Name etc and attach a document. I have been trying to correct / change the code on the form (using CGI) for a while now but I cannot get it to work.

Please please please could someone help me, because as I said I am new to all this and have try / read everything I can but I am totally getting confused now! I have contacted the web host provided but they don't seem to want to help.

Anyway I have included the upload script and form script (plus some of the rest of the page script - if you can help and need the rest I can post it) I have been trying to correct and would be very grateful if someone could try and direct me to how to make it work.

Also any advice on where the forms / upload script should go would be welcome as I have read that if it is not put in the right place the whole thing will not work.



As I said I am TOTALLY confused with it all now and really could do with some help!


Thanks


Upload script

#!/usr/bin/perl -wT

use strict;
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Basename;

$CGI::POST_MAX = 1024 * 5000;
my $safe_filename_characters = "a-zA-Z0-9_.-";
my $upload_dir = "/uploads";

my $query = new CGI;
my $filename = $query->param("DOCUMENT1");
my $email_address = $query->param("email_address");

if ( !$filename )
{
print $query->header ( );
print "There was a problem uploading your document (try a smaller file).";
exit;
}

my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );
$filename = $name . $extension;
$filename =~ tr/ /_/;
$filename =~ s/[^$safe_filename_characters]//g;

if ( $filename =~ /^([$safe_filename_characters]+)$/ )
{
$filename = $1;
}
else
{
die "Filename contains invalid characters";
}

my $upload_filehandle = $query->upload("DOCUMENT1");

open ( UPLOADFILE, ">$upload_dir/$filename" ) or die "$!";
binmode UPLOADFILE;

while ( <$upload_filehandle> )
{
print UPLOADFILE;
}

close UPLOADFILE;

print $query->header ( );
print <<END_HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Serif WebPlus X5 (13.0.3.029)">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
<title>Thanks You</title>
<style type="text/css">
img {border: none;}
</style>
</head>
<body>
<p>Thanks for uploading your document</p>
<p>Your email address: $email_address</p>
<p>Your document:</p>
<p><img src="/upload/$filename" alt="DOCUMENT1" /></p>
</body>
</html>
END_HTML


Form script


<img src="wpimages/wp8ffdb634_06.png" width="27" height="1023" border="0" id="pcrv_15" alt="" onload="OnLoadPngFix()" style="position:absolute;left:1px;top:32px;">
<img src="wpimages/wpcb783fe0_06.png" width="28" height="996" border="0" id="pcrv_16" alt="" onload="OnLoadPngFix()" style="position:absolute;left:771px;top:49px;">
<div id="wp_gallery_pg_1" style="position:absolute; left:34px; top:160px; width:725px; height:310px; overflow:hidden;"></div>
<img src="wpimages/wpe1308a55_05_06.jpg" width="727" height="31" border="0" id="pic_34" alt="" style="position:absolute;left:36px;top:1047px;">
<img src="wpimages/wp7d8c11ab_06.png" width="339" height="483" border="0" id="qs_72" alt="" onload="OnLoadPngFix()" style="position:absolute;left:423px;top:533px;">
<form id="form_17" name="DOCUMENT1" onsubmit="return validate_form_17(this)" action="/cgi-bin/upload2.cgi" method="post" target="_self" enctype="multipart/form-data" style="margin:0px;">
<div id="txt_78" style="position:absolute;left:437px;top:608px;width:125px;height:21px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="edit_19"><span class="Normal-C-C1">Company Name</span></label></p>
</div>
<input type="text" id="edit_19" name="COMPANY" value="" style="position:absolute; left:559px; top:608px; width:178px;">
<div id="txt_2" style="position:absolute;left:437px;top:638px;width:87px;height:23px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="edit_1"><span class="Normal-C-C1">First Name</span></label></p>
</div>
<input type="text" id="edit_1" name="NAME" maxlength="50" value="" style="position:absolute; left:559px; top:638px; width:178px;">
<div id="txt_6" style="position:absolute;left:437px;top:668px;width:78px;height:19px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="edit_4"><span class="Normal-C-C1">Surname</span></label></p>
</div>
<input type="text" id="edit_4" name="SURNAME" maxlength="50" value="" style="position:absolute; left:558px; top:668px; width:178px;">
<div id="txt_1" style="position:absolute;left:437px;top:699px;width:115px;height:20px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="edit_2"><span class="Normal-C-C1">Email Address</span></label></p>
</div>
<input type="text" id="edit_2" name="EMAIL" maxlength="100" value="" style="position:absolute; left:557px; top:698px; width:180px;">
<div id="txt_3" style="position:absolute;left:437px;top:729px;width:94px;height:21px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="edit_3"><span class="Normal-C-C1">Tel Number</span></label></p>
</div>
<input type="text" id="edit_3" name="PHONE" maxlength="20" value="" style="position:absolute; left:557px; top:729px; width:180px;">
<div id="txt_79" style="position:absolute;left:437px;top:761px;width:91px;height:55px;overflow:hidden;">
<p class="Wp-Normal-P"><span class="Normal-C-C1">Brief </span></p>
<p class="Wp-Normal-P"><span class="Normal-C-C1">Description</span></p>
</div>
<div id="txt_4" style="position:absolute;left:437px;top:926px;width:89px;height:39px;overflow:hidden;">
<p class="Wp-Normal-P"><label for="file_1"><span class="Normal-C-C2">U</span><span class="Normal-C-C1">pload </span></label></p>
<p class="Wp-Normal-P"><label for="file_1"><span class="Normal-C-C1">Document</span></label></p>
</div>
<input type="file" id="file_1" name="DOCUMENT" size="18" style="position:absolute; left:528px; top:926px; width:217px; ">
<input type="submit" style="position:absolute; left:664px; top:967px; width:81px; height:22px;" id="butn_1" value="Submit">
<textarea id="text_2" name="COMMENT" rows="9" cols="20" style="position:absolute; left:556px; top:760px; width:181px; height:150px;"></textarea>
</form>
<div id="txt_62" style="position:absolute;left:516px;top:547px;width:150px;height:43px;overflow:hidden;">
<h2 class="Wp-Heading-2-P"><span class="Heading-2-C"><br></span></h2>
<h2 class="Wp-Heading-2-P"><span class="Heading-2-C-C0">Get a Quote</span></h2>
</div>
<div id="txt_81" style="position:absolute;left:61px;top:469px;width:692px;height:61px;overflow:hidden;">
<p class="Wp-Normal-P"><span class="Normal-C-C3"> &nbsp;Welcome to First Choice Translation</span></p>
</div>
<script type="text/javascript" src="wpscripts/jsValidation.js"></script>
</div>
</body>
</html></font>