zentara wrote: Here this upload script might suit your purpose. I'll leave it up to you to add the filtering for gif, and jpgs. It should be obvious where it goes. #### #!/usr/bin/perl -wT use strict; use CGI; my $q = new CGI; #The max size of the uploaded file: $CGI::POST_MAX = 1024 * 1024 * 30; my $maxfile = $CGI::POST_MAX; #The folder with the uploaded files: my $outfolder = "uploads"; &upload; ####################################################### sub upload { my ($filen, $ext); #Print the start of the page: $| = 1; print < eof my $file = $q->upload('file'); my $filename = $file; $filename =~ s/^.*\///g; $filename =~ s/^.*\\//g; $filename =~ s/\-/_/g; $filename =~ s/^\.*//g; $filename =~ s/ /_/g; my $allpath = $file; if ($filename =~ /\./) { $filen = $`; $ext = $'; } my $maxtries=4; for (my $i=1; $i < $maxtries; $i++) { if (-e "$outfolder/$filename") { $filename = $filen . "_" . $i . '.' . $ext; } } #Create the file on the server, and print the "." on the page: open(OUT, ">$outfolder/$filename") or die "Can't open $outfolder/$file for writing. - $!"; binmode OUT; while(read($file, my $buffer, 4096)){; print OUT $buffer; } close OUT; my $filesize = -s "$outfolder/$filename"; $filesize = (int(($filesize / 1024) * 10) / 10); $filesize = "$filesize KB"; #Print on the browser: my $script = 'http://zentara.zentara.net/~zentara/up2.html'; print <
The file $filename was successfully uploaded!
The file has $filesize.