in reply to Non-Duplicate File Names, Security, and Self Cleaning
Try to use File::Temp for creation of a temporary file safely.
How can I tell the script to erase the file if it isn't downloaded within, say, ten minutes (to keep some cracker from filling the server with huge .zip files just for kicks)?You can add in your download script a something like this:
sub erase_files { my $period = 10; opendir(DIR, '/your/tmp/dir') or die $!; my @files = grep {!(/^\./) && /\.zip$/} readdir(DIR); close DIR; my $now = localtime; for my $file (@files) { my $ftime = (stat($file))[9]; if(($now - $ftime) > $period*3600) { unlink $file } } }
--------------------------------
SV* sv_bless(SV* sv, HV* stash);
|
|---|