http://www.perlmonks.org?node_id=33612

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Please excuse as I am somewhat of a newbie. I checked the FAQ's & other resources on this site and couldn't find a clear cut answer. I'm writing a program for students so they can upload & download test over the web. It is a CGI program in Perl. Does CGI.pm have any built in commands that support file loading or FTP or something? I also need to record the times which students finish downloading or uploading files if anyone has a suggestion for that as well. Thanks in advance for any help, Ed K. Chicago
  • Comment on General ? re: downloading & uploading files in Perl

Replies are listed 'Best First'.
Re: General ? re: downloading & uploading files in Perl
by ncw (Friar) on Sep 22, 2000 at 12:22 UTC
    You can upload files using CGI module no trouble - see the CREATING A FILE UPLOAD FIELD section in the documentation.

    You would use the webserver and http to download files - just emit an <a href="file.txt"> as usual in your output for the user to click on.

    If you want this logged then either look in the web logs or make the cgi return the file eg, <a href="my.cgi?file=file.txt">. Make sure the files aren't directly accessible by the webserver in this case.

    CGI doesn't deal with FTP. In fact I suggest you steer clear of FTP - it is hard to set up securely. You can investigate the Net::FTPServer module if you are desperate for FTP.

RE: General ? re: downloading & uploading files in Perl
by princepawn (Parson) on Sep 22, 2000 at 17:04 UTC
    If you are using Unix and want to do file uploads to a webserver via a form I suggest my CPAN module HTTP::File .

    I do not recommend my module for Windows as there have been some usage problems on Windows that could not be resolved.