とあるフリーのCGIスクリプトを使ってサイト運営をしようとしていますが、画像をアップロードする部分で、gif,jpgはできるのですが、pngではエラーになります(「画像が判別できません。」と表示されます。仕様上は3種類可)。
下記が該当部分だと思いますが、どのように修正すればよいか教えていただければ幸いです(関係ないと思いますが、httpsのサイトです)。
if($form{file1} && !$form{ok1} && !$main_img){
$file_type_temp1 = @form[0];
($temp_file1, $content_type1) = split ("\n", $file_type_temp1);
chop $content_type1;
$file1 = "";
if($content_type1 =~ /^Content-Type: image\/gif$/){
$file1 = "$time\_1\.gif";
$sh1 = "gif";
}
elsif($content_type1 =~ /^Content-Type: image\/pjpeg$/ or $content_type1 =~ /^Content-Type: image\/jpeg$/){
$file1 = "$time\_1\.jpg";
$sh1 = "jpg";
}
elsif($content_type1 =~ /^Content-Type: image\/x-png$/){
$file1 = "$time\_1\.png";
$sh1 = "png";
}
else{
&error("$content_type1","画像が判別できません。");
}
elsif($content_type1 =~ /^Content-Type: image\/x-png$/ or $content_type1 =~ /^Content-Type: image\/png$/){
じゃ駄目でしょうか?
おかげさまで解決しました。ありがとうございます!
2018/05/07 20:21:22こちらこそ、久々にPerl質問で嬉しかったです(^o^)
2018/05/07 21:00:06