#!/usr/bin/perl
# uploader script
# $id:$
#
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Text::TagTemplate;
BEGIN {
require 'upload.pl';
require 'tags.pl';
}
my $CONTRIBDIR = '/www/Detritus/uploads';
my $TEMPLATEDIR = '/www/Detritus/templates';
$| = 1;
umask(0002);
$q = new CGI;
$q->import_names;
print $q->header;
my $sizelimit = 250000; # max size of uploaded file.
my $target = time . $$;
my $template= "$TEMPLATEDIR/upload.html";
my $outputfile;
# do ERROR-checking and print any ERRORs before printing form (if applicable)
# submit the data and we're done.
if ($q->param()) {
# error check
if($Q::soundfile) {
$Q::soundfile =~ /\.(\w+$)/; # get the extension
$target .= ".$1";
} else {
$ERROR .= "no sound file chosen.";
}
if(!$ERROR) {
my ($error, $file) = &SubmitFile($Q::soundfile, "$CONTRIBDIR/" . $target, 'mp3|jpg',$q, $sizelimit);
warn " target is $target";
$ERROR .= $error if($error);
unless($file) { $ERROR .= "No successful uploads.\n
" };
if(!$ERROR) {
$MESSAGE .= "