Perl

Menu

In-Class Assignment 10

This assignment will help you to become familiar with using HTML::Template in your CGI applications, as well as using the <input type="file" ...> input method to upload files from the user.

Write a Perl CGI script that will open the template file /cs/lallip/perl/ica10.tpl and display its contents. The file will display a form for a user to upload a jpeg image. Below the form will be displayed all the jpegs found in your public.html/ic10/ directory (that is, all of the files ending in '.jpeg' or '.jpg' (case insensitive)).

If there are no parameters to the CGI script, simply open the template, obtain a list of .jpg's in your public.html/ic10 directory, and fill out the template parameters to populate the list of images. If the 'file' parameter has been passed, first upload the file supplied by the user (also to your public.html/ic10 directory) , then display the form and images (including the newly uploaded file) again.

Notes

Remember that you can obtain your home directory like so:
my $user = 'lallip';
my $home = glob("~$user");
To speed things along, you should be able to use my installation of HTML::Template rather than downloading it from CPAN. Include these lines in your CGI script:
use lib '/cs/lallip/lib';
use HTML::Template;
(But please make sure to download it and use your own copy when doing HW6...)

Submission Instructions

To submit, run the program ~lallip/public/ic_sumit.pl on solaris.remote.cs.rpi.edu. Your program is due by 6pm today, November 16, 2005

Perl Quotes
Perl Quotes