in reply to code problem
If the purpose of the script is to track how many times the file is downloaded, you should move the file outside of a public directory. As it stands now, anyone that knows the direct link to the file can download, thus bypassing your logging.
Also, just for reference, a more perlish way of writing your code (not that I am endorsing your method of solving your problem, but..) it would be:
#!/usr/local/bin/perl -w use strict; my $FILE= "/home/username/cgi-bin/test/file.exe"; print "Content-Type: application/octet-stream\n\n"; open(FH, $FILE) || die "Can't access file: $_\n"; print <FH>; close(FH);
|
|---|