in reply to using die in CGI context / 500 errors
use CGI::Carp(fatalsToBrowser); [download]
open(LOCAL, ">$dir/$name") or print $!; [download]