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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File download

Status
Not open for further replies.

photores

Programmer
Sep 12, 2000
13
RU
Hi! Please help.
How I can download file from ftp server via browser. I try use code below, but it not download file. it print file in browser.

-----------------------------------------------------------
print "Content-type: file\n\n";# I seem this is wrong?
eval {
use Net::FTP;
use CGI qw:)standard);
};
print $@;
my $file = param('file');

my $ftp = Net::FTP->new("ftp.tripod.com");
$ftp->login('user','password');
$ftp->cwd('script');
$ftp->get($file,*STDOUT);
-----------------------------------------------------------
 
The line '$ftp->get($file,*STDOUT);' gets the file and stores it on standard output, which in this case is the browser. If you want to download the file and store it locally, do the following.

$ftp->get($file, $dir);
where $dir is the desired directory.

 
Hi!
I want start file download dialog after user was click on "Download" button on my http site. File is stored on another ftp server.
I seem, it is standatd output?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top