if(-e $file) { if(open(SESAME, "< $file")) { print "Content-Disposition: attachment; filename=$file\n"; print "Content-Type: application/octet-stream\n"; print "Content-Length: " . (-s $file) . "\n\n"; while() { print $_; } close(SESAME); } else { print "Content-Type: text/html\n\nError: Could not read from file\n"; } } else { print "Content-Type: text/html\n\nError: invalid filename\n"; }