upload.pl


NAME

upload.pl - upload an image to a user/script specified directory and save the related image information to a database.


DESCRIPTION

upload.pl is a short script which uploades images and saves the related information to a database by using the Perl module Database.pm. It is designed to be used as a CGI script called by an html document which supplies the parameter values for the script.


EXPECTED PARAMETERS


These parameters are expected to come from input fields of the same name contained in the html calling the script, whether it be hidden fields or form input.


EXAMPLES

Here is some sample html that could be used to call the script and pass it the appropriate parameters:

<form method=post enctype="multipart/form-data" action="../../cgi-bin/upload.pl">
<table width="550" cellspacing="0" cellpadding="10" align="center">
<input type="hidden" name="donePage" value="http://dante.sci.utah.edu/develop/simpson/scratch/file_upload/submit_select.html" />
<input type="hidden" name="errorPage" value="http://dante.sci.utah.edu/develop/simpson/scratch/file_upload" />
<input type="hidden" name="xml" value="../scratch/file_upload/database/images.xml" />
<input type="hidden" name="xsl" value="images.xsl" />
<input type="hidden" name="dtd" value="images.dtd" />
<table>

...Assign the rest of the input parameters using input tags...

</table>
</form>

Example html form pages which use upload.pl :

Radio Buttons
Drop Down Menu
Hidden Fields
Text Box


DEPENDENCIES

Uses modules Database.pm, CGI and CGI::Carp qw(fatalsToBrowser). Database.pm in turn uses modules XML::Simple, Data::Dumper, and Iterator.


CAVEATS

This script does not yet include image resizing. Only one image may be uploaded at a time. File types are tested based on the file extension, which may be a problem for mac files which do not have file extensions.


METHODS

Upload() - If file is of acceptable file type and destination directory is valid, uploads file to $baseDir/$dir and writes its info to the database.


FILES

To be fully functional, needs to work with the following files: Optional additional scripts:


BUGS

To report a bug, send mail to Jennifer Simpson at (simpson@cs.utah.edu)


ERROR HANDLING

Errors result in an error message being sent to the browser as well as the sever error log. Error conditions include:


SEE ALSO

upload.pl

Design document for upload.pl, Database.pm, and intializeDB.pl.

Documentation of Database.pm.

Html form pages which use this script :

Radio Buttons
Drop Down Menu
Hidden Fields
Text Box


AUTHORS

Jennifer Simpson (simpson@cs.utah.edu) and Erik Jorgensen (erikj@cs.utah.edu).


NOTES

Database.pm needs to be put in the same directory as upload.pl. The code for Database.pm can be found at Database.pm