in reply to Uploading a file

... upload_file($cgi->param('file_data')); ... my $fh = $query->upload( $filename );

You're not properly using CGI::upload(). upload() takes the parameter name, not the parameter value. So, by changing it into the following, it could start to work:

my $fh = $query->upload( 'file_data' );

But then again, you could maybe work some more on your code or error messages.