- $new->mime_type($cgi->uploadInfo($filename)->{'Content-Type'});
- $new->title($cgi->param('title'));
+ # use the original filename here, not the stripped form
+ $new->mime_type(
+ $cgi->uploadInfo( scalar($cgi->param('file')) )->{'Content-Type'}
+ );
+ $new->title( scalar($cgi->param('title')) );