freelanceprogrammers.org Forum Index » Perl

CGI script problem


View user's profile Post To page top
superlathe Posted: Sat Sep 18, 2004 1:53 am


Joined: 18 Sep 2004

Posts: 1
CGI script problem
Hi everyone,
I have a serious problem with my cgi file.
For days I`ve been trying to make it work.
Always the same error message:
Premature end of script headers: upload.cgi

http://www.indeedvideo.com/cgi-bin/upload.cgi

I tried all I could, ASCII, saved in unicode, I asked server for
paths etc..

If anyone as a idea, PLEASE tell me!!

Here`s upload.cgi :

#!/usr/bin/perl
use CGI;
$upload_dir = "/home/httpd/vhosts/indeedvideo.com/upload";
$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;

open EMAILFILE, ">$upload_dir/$filename.email";
print EMAILFILE $email_address;
close EMAILFILE;

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="/upload/$filename" border="0">
</BODY>
</HTML>
END_HTML
1;
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help