PHP图像类型应用程序/png

PHP图像类型应用程序/png,php,image,cross-browser,png,jpeg,Php,Image,Cross Browser,Png,Jpeg,出于某种原因,图像类型在IE 7和Edge中显示为“application/png”,但在Chrome和Firefox中显示为“image/png”。我试过几种不同的图像,JPEG做同样的事情。这正常吗?我是否应该包含一个or语句来解释“应用程序/png”?还是我做错了什么 if ((($screenshot_type == 'image/gif') || ($screenshot_type == 'image/jpeg') || ($screenshot_type =

出于某种原因,图像类型在IE 7和Edge中显示为“application/png”,但在Chrome和Firefox中显示为“image/png”。我试过几种不同的图像,JPEG做同样的事情。这正常吗?我是否应该包含一个or语句来解释“应用程序/png”?还是我做错了什么

      if ((($screenshot_type == 'image/gif') || ($screenshot_type == 'image/jpeg') || 
      ($screenshot_type == 'image/pjpeg') || ($screenshot_type == 'image/png')) && 
      (($screenshot_size > 0) && ($screenshot_size <= GW_MAXFILESIZE))) {
      if ($_FILES['screenshot']['error'] == 0) {

        // Move the file to the targe upload folder
        $target = GW_UPLOADPATH . $screenshot;
        if (move_uploaded_file($_FILES['screenshot']['tmp_name'], $target)) {
            // Connect to the database
            $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
              or die('Unable to connect to databse');
            // Write the data to the database
            $query = "INSERT INTO guitarwars VALUES (0, NOW(), '$name', '$score', '$screenshot')";
            mysqli_query($dbc, $query)
              or die('Unable to complete query');

            // Confirm success with the user
            echo '<p>Thanks for adding your new high score!</p>';
            echo '<p><strong>Name:</strong> ' . $name . '<br>';
            echo '<strong>Score:</strong> ' . $score . '</p>';
            echo '<img src="' . GW_UPLOADPATH . $screenshot . '" alt="Score image" /></p>';
            echo '<p><a href="index.php">&lt;&lt; Back to high scores</a></p>';

            // Clear the score data to clear the form
            $name = "";
            $score = "";
            $screenshot = "";

            mysqli_close($dbc);
      }
      else {
        echo '<p class="error">Sorry, there was a problem uploading your screen shot image.</p>';
      }
    }
  }
  else {
    echo '<p class="error">The screen shot must be a GIF, JPEG, or PNG image file no ' .
      'greater than ' . (GW_MAXFILESIZE / 1024) . ' KB in size.<br>' . $screenshot_size . '<br>' . $screenshot_type . '</p>';
  }
if(($screenshot_type=='image/gif')| |($screenshot_type=='image/jpeg')|
($screenshot_type=='image/pjpeg')| |($screenshot_type=='image/png'))&&

($screenshot_size>0)和&($screenshot_size不同的浏览器和操作系统提供不同的mime类型。您可能只需在上载的文件上使用,然后打开$getimagesizeresult[2]对于IMG_PNG、IMG_JPG、IMG_GIF的情况,您可以自己应用适当的mime类型。

不同的浏览器和操作系统提供不同的mime类型。您可能只需在上载的文件上使用,然后打开$getimagesizeresult[2]使用IMG_PNG、IMG_JPG、IMG_GIF的案例,并自行应用适当的mime类型。

您最好检查。您最好检查。