Php 文件上传在某些图像上不起作用。然后挂起504

Php 文件上传在某些图像上不起作用。然后挂起504,php,Php,两个多星期以来,我一直在试图弄清楚这件事到底是怎么回事,但仍然没有更进一步 我现在正在拉扯我的头发 它对一个图像有效,但对另一个图像无效?而且根本不需要很长时间 我加入了一个基本脚本,但它仍然在特定的图像上超时 <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $upload

两个多星期以来,我一直在试图弄清楚这件事到底是怎么回事,但仍然没有更进一步

我现在正在拉扯我的头发

它对一个图像有效,但对另一个图像无效?而且根本不需要很长时间

我加入了一个基本脚本,但它仍然在特定的图像上超时

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));

// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
  $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  if($check !== false) {
    echo "File is an image - " . $check["mime"] . ".";
    $uploadOk = 1;
  } else {
    echo "File is not an image.";
    $uploadOk = 0;
  }
}

// Check if file already exists
if (file_exists($target_file)) {
  echo "Sorry, file already exists.";
  $uploadOk = 0;
}

// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
  echo "Sorry, your file is too large.";
  $uploadOk = 0;
}

// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
  echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
  $uploadOk = 0;
}

// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
  echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
  if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
  } else {
    echo "Sorry, there was an error uploading your file.";
  }
}
?>

这两幅图是

第一个图像工作,但第二个图像超时

我也在吐phpinfo

还有测试脚本


日志什么也没说。

你是故意错过拼写其他域名吗?我不明白你的意思。→ 找不到文件(404)修复了我的错误我已经检查了你的代码,一点问题都没有(实际上我可以根据你在我的服务器上的代码上传你的第二个文件)。请仔细检查“uploads”文件夹是否存在,是否可写。你是否故意漏掉其他域名的拼写?我不明白你的意思。→ 找不到文件(404)修复了我的错误我已经检查了你的代码,一点问题都没有(实际上我可以根据你在我的服务器上的代码上传你的第二个文件)。请仔细检查“uploads”文件夹是否存在且可写。