
March 1st, 2004, 01:28 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Net::FTP put function problem
I have created a small program that uploads a file to our ftp server but it returns this error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
Here is my code:
Code:
#!\xampp\perl\bin\perl.exe
use CGI;
use Net::FTP;
use Carp::Heavy;
$co = new CGI;
$ftphost = "ftp.website.com";
$username = "username";
$password = "password";
$filename = "E:\\Server\\hellocgi.pl";
print $co->header,
$co->start_html("Test FTP");
if ($ftp = Net::FTP->new($ftphost,Debug=>1))
{
if (!$ftp->login($username,$password)) {
print "Invalid username/password",
$co->end_html;
} else {
$ftp->pasv();
if (!$ftp->put($filename)) {
print "Error uploading file",
$co->end_html;
} else {
print "File uploaded",
$co->end_html;
}
}
$ftp->quit;
} else {
print "Cannot connect to host",
$co->end_html;
}
Our server does not support Perl so i used PAR to create an EXE file which is supported by our site. It seems that the this happens when "$ftp->put($filename)" is executed. What is wrong with my program?
|