- # We need to reopen stdout temporarily, because in FCGI
- # environment, stdout is tied to FCGI::Stream, and the child
- # of the run3 wouldn't be able to reopen STDOUT properly.
- my $stdin = IO::Handle->new;
- $stdin->fdopen( 0, 'r' );
- local *STDIN = $stdin;
+ for my $attr_name (qw( content-disposition.filename content-type.name )) {
+ my $value = Encode::decode("UTF-8",$head->mime_attr($attr_name));
+ if ( defined $value && $value =~ /\S/ ) {
+ return $value;
+ }
+ }
+ return;
+}