Apart from the standard hint 'check the logs', some
code review remarks:
- First thing, always use -T for CGI scripts. See perlsec.
- The Content-Type Header is printed twice in case of an error, since you do print "Content-type:text/html\n\n"; at the start of your script and print $q -> header ("text/html"), in sub error
- There's no submit button in your html file
and onsubmit="return validate()" is not really helpful for us to test your script, since there's no JavaScript in it.
- The variable $fh is undefined. Change $query->upload("$file") to $query->upload('fname'). The upload method expects a CGI param, not it's value.
- You have a block beginning with if ($file) { - well, fine; but else?
- In sysopen OUTPUT, UPLOAD_DIR . $file,O_CREAT|O_EXCL you forgot one of the flags O_WRONLY or O_RDWR. So your OUTPUT is only opened for input.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}