use strict; use Env; use CGI qw(:standard); use Digest::MD5 qw(md5 md5_hex md5_base64); use POSIX qw(strftime); use Date::Manip; $ENV{'PATH'} = '/usr/bin:/bin:'; my $query = CGI->new; my $modtime = scalar(gmtime(time - (3600 * 8))) . " GMT"; my $exptime = scalar(gmtime) . " GMT"; ###################################################### # # Form stuff asking for the upload, title, filename, # author, and other relevant file-specific data here # ###################################################### # ... sub print_results { my $query = shift; my ($length, $filename, $filetype); my $directory = "/tmp/palm"; my $file_name = $query->upload('pl_upload'); if (!$file_name) { print "No file received..\n"; return; } $file_name =~ s/.*[\/\\](.*)/$1/; print h3("File Name"), $file_name; my $md5file = md5_hex($file_name); open(SAVEPDB,">$directory/${file_name}_${md5file}") or die $!; while (<$file_name>) { print SAVEPDB $_; $length += length($_); } close SAVEPDB; # Print file data here, size, title, etc. } #### CREATE TABLE sample_uploads ( sample_id tinyint(4) NOT NULL default '0', sample_submit_date datetime NOT NULL default '0000-00-00 00:00:00', sample_remote_addr text NOT NULL, sample_remote_host text NOT NULL, sample_remote_ua text NOT NULL, sample_db_title text NOT NULL, sample_user_name text NOT NULL, sample_copyright tinyint(4) NOT NULL default '0', sample_image_depth tinyint(4) NOT NULL default '0', sample_category tinyint(4) NOT NULL default '0', sample_description text NOT NULL, sample_filename text NOT NULL, PRIMARY KEY (sample_id) ) TYPE=MyISAM;