Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Info to Server

Status
Not open for further replies.

dulla

Technical User
Feb 3, 2003
54
I am trying to sending a file to my server. I have obtained a script that i cannot get to work. the html is here:


I have set the permissions and changed the variables, yet i still get 'server error premature end of script headers' as an error. any ideas? the referenced cgi script is:

#!/usr/bin/perl -w

use CGI;

$upload_dir = "
$query = new CGI;

$filename = $query->param("photo");
$email_address = $query->param("email_address");
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("photo");

open UPLOADFILE, ">$upload_dir/$filename";

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

close UPLOADFILE;

print $query->header ( );
print <<END_HTML;

<HTML>
<HEAD>
<TITLE>Thanks!</TITLE>
</HEAD>

<BODY>

<P>Thanks for uploading your photo!</P>
<P>Your email address: $email_address</P>
<P>Your photo:</P>
<img src=&quot;/upload/$filename&quot; border=&quot;0&quot;>

</BODY>
</HTML>

END_HTML
 
Server error
Error message:
Premature end of script headers: fileuploader.cgi
Click here to notify the Webmaster.
Error 500
Tue Oct 21 23:29:53 2003
 
That gets printed to browser.

The actual error log will have a more detailed error message.
 
look at this one too. I get the same error for it.


view the source on this. it calls a file called 'fileuploader.cgi'. i believe some HTML is called within fileuploader.cgi.


print <<&quot;(END_HTML)&quot;;
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>

<html><head>

maybe it is here where the scripting error occurs? anyway, the file reads:


#!/usr/bin/perl

##############################################################################
# #
# File Uploader Version 1.2 #
# By Paul Benn :: paul@notjustcomputers.co.uk :: #
# #
##############################################################################
# #
# Modifications Copyright (c) 2002 Paul JJ Benn, All Rights Reserved. #
# This version of File Uploader may be used and modified free of charge by #
# anyone so long as this copyright notice remains intact. By using this code #
# you agree to indemnify Paul Benn and Not Just Computers of any liability #
# arising from it's use. You also agree that this code cannot be sold to #
# any third party without prior written consent from Paul JJ Benn #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
# #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact. #
# #
##############################################################################

use CGI;
use DBI;


# ..:: Define Variables Start ::.. #

#### Where to Save put the files ####
# Change this for the LITERAL PATH to save the files to. Do not forget the ending / #
$upload_dir = &quot;/uploadlog/uploads/&quot;;


#### How to Save the Data ####

$storein = &quot;0&quot;; # 0=Txt File 1=MySQL


#### If yuo have chossen Txt File above then set the settings below ####

# Change this for the LITERAL PATH for the datafile. Do not forget the ending / #
$data_dir = &quot;/uploadlog/&quot;;

# Set the file name to be used for saving the upload infomation in #
$datafile = &quot;uploaded.txt&quot;;


#### If you have chossen MySQL above then set the settings below ####

$host = &quot;db.domain.com&quot;; # Database host url or IP
$dbname = &quot;myname&quot;; # Name of MySQL Database
$table = &quot;fupload&quot;; # Name of table to use
$usrname = &quot;YourUserName&quot;; # Username to access table
$passwrd = &quot;YourPassword&quot;; # Password for table

#### Send notifaction email to Admin ####

$adminemailaddress = &quot;user955891\@marshonsfashions.com&quot;; # You must put the \ before the @
$sendadminemail = '1'; # 0 = Do not Send alert, 1 = Send Alert Message to Admin
$mailprog = '/usr/lib/sendmail -i -t'; # Path to Sendmail



########### Don't Change anything below here ###########
########## Unless you know what you are doing ##########

$version = &quot;v1.2&quot;;
$query = new CGI;
&parse_form;


sub parse_form
{
$filename = $query->param(&quot;file&quot;);
$fileinfo = $query->param(&quot;fileinfo&quot;);
$email_address = $query->param(&quot;email_address&quot;);
$your_name = $query->param(&quot;realname&quot;);
$redirect_url = $query->param(&quot;redirect&quot;);
$ipaddress = $ENV{'REMOTE_ADDR'};
$filename =~ s/(\s+|\n)?,(\s+|\n)?/,/g;

$upload_filehandle = $query->upload(&quot;file&quot;);

if ($filename eq '') {
&error_html;
}
&upload_file;
}

sub upload_file
{

$filepath=$filename;
if ($filepath =~ /([^\/\\]+)$/)
{
$filename=&quot;$1&quot;;
}
else
{
$filename=&quot;$filepath&quot;;
}
# if there's any space in the filename, get rid of them
$filename =~ s/\s+//g;


open UPLOADFILE, &quot;>$upload_dir/$filename&quot;;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
#print $query->header ( );

open(FILE, &quot;$upload_dir/$filename&quot;) || &error(&quot;Can't get filesize $upload_dir/$filename ($!)&quot;);
$filesizeb = -s FILE;
close(FILE);

$filesize = sprintf(&quot;%.1f&quot;, $filesizeb/1024) ;

if ($storein==&quot;0&quot;){
&write_file;
}

if ($storein==&quot;1&quot;){
&loadmysql;
}


}


sub write_file
{
##### RECORD INFO

($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst) = localtime();
$mon++;
$year = 1900 + $year;
$today = $mday . &quot;-&quot; . $mon . &quot;-&quot; . $year . &quot; &quot; . $hour . &quot;:&quot; . $min . &quot;:&quot; . $sec;


open (UPLO, &quot;>> $data_dir/$datafile&quot;);

print UPLO $your_name . &quot;,&quot; . $email_address . &quot;,&quot; . $filename . &quot;,&quot; .
$fileinfo . &quot;,&quot; . $ipaddress . &quot;,&quot; . $today . &quot;,&quot; . $filesize . &quot;\n&quot;;
close (UPLO);
$mysqlpost= &quot;Not Used&quot;;

&sendmailalert;

}


sub loadmysql
{
# Save data to MySQL Database
#Connect to database

my $dbh = DBI->connect(&quot;DBI:mysql:$dbname:$host&quot;, $usrname, $passwrd)
or die &quot;Can't connect to $data_source: $dbh->errstr\n&quot;;

($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst) = localtime();
$mon++;
$year = 1900 + $year;
$today = $year . &quot;/&quot; . $mon . &quot;/&quot; . $mday;

$sql = &quot;insert into $table (postername, posteremail, filename, fileinfo, ipaddr, datesub, filesize, id) VALUES('$your_name','$email_address','$filename','$fileinfo','$ipaddress','$today','$filesize Kb','0')&quot;;
my $sth = $dbh->prepare($sql);
$sth->execute();
$mysqlpost= &quot;Updated Okay&quot;;

&sendmailalert;

}

sub myredirect
{
print &quot;Location: $redirect_url\n\n&quot;;
}

sub sendmailalert
{
if ($sendadminemail==&quot;1&quot;){

open MAIL, &quot;|$mailprog -t&quot;;
print MAIL &quot;To: $adminemailaddress\n&quot;;
print MAIL &quot;From: $email_address ($your_name)\n&quot;;
print MAIL &quot;MIME-Version: 1.0\n&quot;;
print MAIL &quot;Subject: File $filename has been Uploaded\n&quot;;
print MAIL &quot;Content-Type: multipart/mixed; boundary=\&quot;------------$boundary\&quot;\n&quot;;
print MAIL &quot;\n&quot;;
print MAIL &quot;This is a multi-part message in MIME format.\n&quot;;
print MAIL &quot;--------------$boundary\n&quot;;
print MAIL &quot;Content-Type: text/html; charset=us-ascii\n&quot;;
print MAIL &quot;Content-Transfer-Encoding: 7bit\n\n&quot;;
print MAIL &quot;<b>Dear Admin,\n\n</b><br><br>&quot;;
print MAIL &quot;The file <b>$filename</b> has been uploaded, it is <b><i> $filesize Kb </b></i> in size.<br><br>\n&quot;;
print MAIL &quot;The User sent the following information with the file:<br><br>\n&quot;;
print MAIL &quot;$fileinfo<br>\n&quot;;

print MAIL &quot;<br><br>\n&quot;;


print MAIL &quot;<br>\n&quot;;

print MAIL &quot;\n--------------$boundary--\n&quot;;
print MAIL &quot;\n&quot;;
close MAIL;

$mysqlpost= &quot;Updated Okay and Admin Emailed&quot;;
}


&okay_html;
}


sub okay_html
{
# If redirect option is used, print the redirectional location header. #
if ($redirect_url) {
&myredirect;
}
else
{
print $query->header ( );

print <<&quot;(END_HTML)&quot;;
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>

<html><head>
<title></title>
<style type='text/css'>
BODY {font-family: verdana; font-size:8pt;}
TD {font-family: verdana; font-size:10pt;}
A {color: #3366cc; text-decoration: none;}
</style>
</head>
<body bgcolor='#000000'>
<table style='border: 1 solid black;border-bottom: 0;' width='100%' align='center' cellpadding='2' cellspacing='0' border='0'>
<tr bgcolor='#000000'>
<td style='padding: 5'></td>
<td valign='bottom' align='right'><font size=&quot;+2&quot; color=&quot;Yellow&quot;><b><i>File Uploader</i></b></font></td>
</tr>
<tr bgcolor='#2C4967'>
<td colspan=2 class='main_menu_td'>
<table border='0' cellpadding='4' cellspacing='1'>
<tr>
<td><b> <font size=&quot;+1&quot; color=&quot;White&quot;>Upload Complete</b></td>
</tr>
</table>
</td>
</tr>
</table>
<table style='border: 2 solid black;' width='100%' align='center' cellpadding='4' cellspacing='0' border='0'>
<tr bgcolor='#e8e8e8'>
<td valign='top'>
<table width='100%' cellpadding='10' cellspacing='1' border='0'>
<tr>
<td bgcolor='#ffffff'>
<br>
<font size=&quot;+1&quot;><b>Thanks $your_name,</b></font><br>
<br>
Your file ($filename) has been uploaded successfully.<br>
<br>
<table width='75%' cellpadding='0' cellspacing='2' border='0' align='center' bgcolor='#ffd700'>
<td colspan=2>
<font size=&quot;+1&quot;>The Following information will be kept on file:</font></td>
<tr><td width = '30%'><b>Your Name:</b> </td><td><font color=&quot;#000080&quot;><b>$your_name<b></font><br></td></tr>
<tr><td><b>Your email address: </b></td><td><font color=&quot;#000080&quot;><b>$email_address<b></font><br></td></tr>
<tr><td><b>Your file: </b></td><td><font color=&quot;#000080&quot;><b>$filename<b></font><br></td></tr>
<tr><td><b>File Information: </b></td><td></b><font color=&quot;#000080&quot;><b>$fileinfo<b></font><br></td></tr>
<tr><td><b>File Size: </b></td><td><font color=&quot;#000080&quot;><b>$filesize Kb<b></font><br></td></tr>
<br>
<tr><td><b>Your IP Address: </b></td><td></b><font color=&quot;#000080&quot;><b>$ipaddress<b></font><br></td></tr>
<tr><td><b>MySQL Result: </b></td><td></b><font color=&quot;#000080&quot;><b>$mysqlpost<b></font><br></td></tr>
</table>
</td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='2' border='0'> <tr> <td align='center'><center><font size=-1>
<a href=&quot; Uploader</a> $version &copy; 2002 Paul Benn<br>
A Free Product of <a href=&quot; Just Computers</a> </b>
</font></center></td> </tr> </table> <table width='100%' cellpadding='0' cellspacing='1' border='0'>
<tr>
<td>
<p align='center'>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>

(END_HTML)

exit;
}}



sub error_html
{
print <<&quot;(NOPE)&quot;;

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>

<html><head>
<title></title>
<style type='text/css'>
BODY {font-family: verdana; font-size:8pt;}
TD {font-family: verdana; font-size:10pt;}
A {color: #3366cc; text-decoration: none;}
</style>
</head>
<body bgcolor='#000000'>
<table style='border: 1 solid black;border-bottom: 0;' width='100%' align='center' cellpadding='2' cellspacing='0' border='0'>
<tr bgcolor='#000000'>
<td style='padding: 5'></td>
<td valign='bottom' align='right'><font size=&quot;+2&quot; color=&quot;Yellow&quot;><b><i>File Uploader</i></b></font></td>
</tr>
<tr bgcolor='#2C4967'>
<td colspan=2 class='main_menu_td'>
<table border='0' cellpadding='4' cellspacing='1'>
<tr>
<td><b> <font size=&quot;+1&quot; color=&quot;White&quot;>Error - No File to Upload</b></td>
</tr>
</table>
</td>
</tr>
</table>
<table style='border: 2 solid black;' width='100%' align='center' cellpadding='4' cellspacing='0' border='0'>
<tr bgcolor='#e8e8e8'>
<td valign='top'>
<table width='100%' cellpadding='10' cellspacing='1' border='0'>
<tr>
<td bgcolor='#ffffff'>
There is no file to upload!<br>
<br>
</td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='1' border='0'> <tr> <td align='center'><center><font size=-1>
<a href=&quot; Uploader</a> $version &copy; 2002 Paul Benn<br>
A Free Product of <a href=&quot; Just Computers</a> </b>
</font></center></td> </tr> </table> <table width='100%' cellpadding='0' cellspacing='1' border='0'>
<tr>
<td>
<p align='center'>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
(NOPE)

exit;

}
 
the 2 files upload.cgi and fileuploader.cgi are referenced:

[Tue Oct 21 15:29:09 2003] [error] [client 209.35.187.126] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:29:09 2003] [error] [client 209.35.187.126] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:29:41 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer:
[Tue Oct 21 21:30:53 2003] [error] [client 209.35.187.121] CGI.pm: Server closed socket during multipart read (client aborted?)., referer: [Tue Oct 21 21:32:12 2003] [error] [client 209.35.187.122] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:32:12 2003] [error] [client 209.35.187.122] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\8317_CH510-28593.pdf> line 778., referer: [Tue Oct 21 22:12:44 2003] [error] [client 209.35.187.124] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 22:12:44 2003] [error] [client 209.35.187.124] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\letter.txt> line 23., referer: [Tue Oct 21 22:13:19 2003] [error] [client 209.35.187.121] Premature end of script headers: fileuploader.cgi, referer:


those were 2 pieces of the log. i don't know much about the error log so i posted the entire thing below:





[Tue Oct 21 14:42:36 2003] [error] [client 209.35.187.122] Premature end of script headers: upload.pl, referer: [Tue Oct 21 15:05:37 2003] [error] [client 209.35.187.122] Premature end of script headers: upload.pl, referer: [Tue Oct 21 15:22:48 2003] [error] [client 209.35.187.125] File does not exist: /home/d/t/user962207/html/ referer: [Tue Oct 21 15:24:24 2003] [error] [client 209.35.187.121] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:24:24 2003] [error] [client 209.35.187.121] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:28:44 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:25:13 2003] [error] [client 209.35.187.122] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:25:13 2003] [error] [client 209.35.187.122] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:25:31 2003] [error] [client 209.35.187.122] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:25:31 2003] [error] [client 209.35.187.122] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:29:09 2003] [error] [client 209.35.187.126] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:29:09 2003] [error] [client 209.35.187.126] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:29:41 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 15:29:41 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/upload.cgi, referer: [Tue Oct 21 15:30:35 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 15:30:35 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/upload.cgi, referer: [Tue Oct 21 15:34:53 2003] [error] [client 209.35.187.122] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:34:53 2003] [error] [client 209.35.187.122] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:36:56 2003] [error] [client 209.35.187.123] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:36:56 2003] [error] [client 209.35.187.123] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:37:25 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:37:25 2003] [error] [client 209.35.187.124] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:40:25 2003] [error] [client 209.35.187.121] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:40:25 2003] [error] [client 209.35.187.121] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:40:43 2003] [error] [client 209.35.187.123] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:40:43 2003] [error] [client 209.35.187.123] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 15:44:01 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 15:44:01 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/upload.cgi, referer: [Tue Oct 21 15:46:29 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 15:46:29 2003] [error] [client 209.35.187.124] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 16:12:44 2003] [error] [client 209.35.187.123] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 16:12:44 2003] [error] [client 209.35.187.123] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 18:45:49 2003] [error] [client 209.35.187.123] script not found or unable to stat: /home/d/t/user962207/cgi-bin/uploader.html
[Tue Oct 21 18:46:55 2003] [error] [client 209.35.187.123] script not found or unable to stat: /home/d/t/user962207/cgi-bin/uploader.htlm
[Tue Oct 21 18:47:30 2003] [error] [client 209.35.187.123] script not found or unable to stat: /home/d/t/user962207/cgi-bin/uploader.htm
[Tue Oct 21 18:48:23 2003] [error] [client 209.35.187.126] Premature end of script headers: uploader.cgi, referer: [Tue Oct 21 18:49:00 2003] [error] [client 209.35.187.126] Premature end of script headers: uploader.cgi, referer: [Tue Oct 21 18:49:00 2003] [error] [client 209.35.187.126] failed to open log file (/usr/apache/logs/cgi.log), referer: [Tue Oct 21 18:49:00 2003] [error] [client 209.35.187.126] fopen: Permission denied, referer: [Tue Oct 21 19:21:02 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/uploader.html
[Tue Oct 21 19:21:25 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 19:21:29 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 19:21:49 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 19:21:49 2003] [error] [client 209.35.187.124] Can't find string terminator &quot;END_HTML&quot; anywhere before EOF at upload.cgi line 24., referer: [Tue Oct 21 19:23:13 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 19:37:22 2003] [error] [client 209.35.187.124] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 20:57:51 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/fileuploader
[Tue Oct 21 20:57:56 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/fileuploader.html
[Tue Oct 21 21:00:28 2003] [error] [client 209.35.187.125] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:04:29 2003] [error] [client 209.35.187.123] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:04:29 2003] [error] [client 209.35.187.123] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 21:04:35 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 21:05:34 2003] [error] [client 209.35.187.126] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:05:34 2003] [error] [client 209.35.187.126] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 21:05:52 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 21:06:03 2003] [error] [client 209.35.187.121] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 21:06:13 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 21:08:24 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/file_upload.html
[Tue Oct 21 21:08:24 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 21:08:24 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/fileuploader.cgi, referer: [Tue Oct 21 21:09:52 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 21:09:52 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/upload.cgi, referer: [Tue Oct 21 21:10:10 2003] [error] [client 209.35.187.123] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:10:10 2003] [error] [client 209.35.187.123] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 21:15:29 2003] [error] [client 209.35.187.126] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:15:29 2003] [error] [client 209.35.187.126] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 21:27:04 2003] [error] [client 209.35.187.124] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:27:04 2003] [error] [client 209.35.187.124] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 21:30:53 2003] [error] [client 209.35.187.121] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:30:53 2003] [error] [client 209.35.187.121] CGI.pm: Server closed socket during multipart read (client aborted?)., referer: [Tue Oct 21 21:32:12 2003] [error] [client 209.35.187.122] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 21:32:12 2003] [error] [client 209.35.187.122] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\8317_CH510-28593.pdf> line 778., referer: [Tue Oct 21 22:12:44 2003] [error] [client 209.35.187.124] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 22:12:44 2003] [error] [client 209.35.187.124] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\letter.txt> line 23., referer: [Tue Oct 21 22:13:19 2003] [error] [client 209.35.187.121] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 23:29:53 2003] [error] [client 209.35.187.124] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 23:29:53 2003] [error] [client 209.35.187.124] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\letter.txt> line 23., referer: [Tue Oct 21 23:30:54 2003] [error] [client 209.35.187.126] Premature end of script headers: upload.cgi, referer: [Tue Oct 21 23:32:32 2003] [error] [client 12.248.181.90] File does not exist: /home/d/t/user962207/html/uploader.html
[Tue Oct 21 23:34:06 2003] [error] [client 209.35.187.126] Premature end of script headers: fileuploader.cgi, referer: [Tue Oct 21 23:34:06 2003] [error] [client 209.35.187.126] Undefined subroutine &main::error called at fileuploader.cgi line 117, <fh00001C%3A\Documents and Settings\Ameen\Desktop\ferhun.txt> line 15., referer: [Tue Oct 21 23:36:40 2003] [error] [client 12.248.181.90] proxy: error reading status line from remote server 209.35.187.205, referer: [Tue Oct 21 23:36:40 2003] [error] [client 12.248.181.90] proxy: Error reading from remote server returned by /cgi-bin/upload.cgi, referer:
 
When I copy and pasted the first script I got the 'Could not find END_HTML error as well. I had a space in front of it. It may have just been an artifact of my copy/paste.

Make sure the END_HTML is the ONLY thing on that line.

The second script is erroring on

pen(FILE, &quot;$upload_dir/$filename&quot;) || &error(&quot;Can't get filesize $upload_dir/$filename ($!)&quot;);
$filesizeb = -s FILE;
close(FILE);


It doesn't know where this &error subroutine is.
 
did you actually get the file to upload on the server in anyone of the codes? Ive messed around with the END_HTML and still the same premature end of script headers error. Do you think it's an issue with my server?
 
Remove the quotes and parens from END_HTML and NOPE (print <<&quot;(END_HTML)&quot;; and print <<&quot;(NOPE)&quot;; should be print <<END_HTML; and print <<NOPE;) - they're not required. Also, MAKE SURE that there's a carriage return immediately after END_HTML and NOPE where it ends the html pages.

There's always a better way. The fun is trying to find it!
 
ok. i have removed the parens and quotes from these where they begin:

print <<END_HTML; and print <<NOPE;

and where they end:

END_HTML

exit;

and

NOPE

exit;

However, i get the same error:

Premature end of script headers: fileuploader.cgi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top