#!/usr/bin/perl use strict; use warnings; use utf8; use CGI; use Encode; my $in = CGI->new(); if(my $up_obj = $in->upload('uploadfile')){ print 'content-type: text/plain; charset=utf-8', "\n\n"; my $up_fh = $up_obj->handle(); my $up_tmppath = $in->tmpFileName($up_obj); my $up_filename = $in->param('uploadfile'); my $up_info = $in->uploadInfo($up_filename); close($up_obj); print 'ファイル位置:', tell($up_fh), "\n"; print 'ファイルサイズ:', -s $up_fh, 'bytes', "\n"; print 'テンポラリファイル PATH:', decode('utf-8', $up_tmppath), "\n"; print 'アップロードファイル名:', decode('utf-8', $up_filename), "\n"; print 'アップロードファイル名 ($up_obj):', $up_obj, "\n"; foreach my $key (keys(%{$up_info})){ my $val = decode('utf-8', $up_info->{$key}); print $key, ':', $val, "\n"; } }else{ print 'content-type: text/html; charset=utf-8', "\n\n"; print 'upload test'; print '

ファイルを指定してください。

', "\n"; print '
'; print '
'; print ''; print '
'; print ''; }