#!/usr/local/bin/perl

# Source of this script: 
# Go to:
# http://search.cpan.org/search?mode=doc&query=ftp+ 


    use Net::FTP;

$direct = "temp";
chdir("$direct");

    $ftp = Net::FTP->new("ftp.sdsc.edu", Debug => 0);
    $ftp->login("anonymous",'damartin@sdsc.edu');
    $ftp->cwd("/pub/outgoing/damartin");
    #$ftp->get("test.txt", "ftp.txt");
    #$ftp->pwd();
    #$ftp->quit;

print "Content-type: text/html\n\n";

print "<html>\n";
print "<head><title>Welcome to ftp download service center - Results</title></head>\n";
print "<body>\n";
print "<h1>ftp download Results</h1>\n";
print "<hr>\n";
print "<input type=\"submit\" value=\"Submit\">\n";
print "<input type=\"reset\" value=\"reset\">\n";
    system("rm *.txt");
    $ftp->get("test.txt");
    system("chmod a+rx *.txt");
    ##print system("pwd");
    #$pwd=$ftp->pwd();
    #@ls=$ftp->ls();
    #print "<hr>\n";
    ##print system("ls");
    ##system("pwd");
    #print "Current Directory<p>\n";
    #print $pwd;
    #print "<hr>\n";
    #foreach $line (@ls) {
	#print $line;
    #}
    $ftp->quit;
print "</form>\n";
print "<hr>\n";
print "</body>\n";
print "</html>\n";


