为什么我得到这个读错误并且echo函数回显图像名称?

时间:2016-04-21 03:09:31

标签: php mysql

$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

if (isset($_POST['submit'])) {
  // Grab the profile data from the POST
  $first_name = mysqli_real_escape_string($dbc, trim($_POST['firstname']));
  $last_name = mysqli_real_escape_string($dbc, trim($_POST['lastname']));
  $gender = mysqli_real_escape_string($dbc, trim($_POST['gender']));
  $birthdate = mysqli_real_escape_string($dbc, trim($_POST['birthdate']));
  $city = mysqli_real_escape_string($dbc, trim($_POST['city']));
  $state = mysqli_real_escape_string($dbc, trim($_POST['state']));
  $old_picture = mysqli_real_escape_string($dbc, trim($_POST['old_picture']));
  $new_picture = mysqli_real_escape_string($dbc, trim($_FILES['new_picture']['tmp_name']));
  echo $new_picture;
  $new_picture_type = $_FILES['new_picture']['type'];
  $new_picture_size = $_FILES['new_picture']['size'];
  The line below is where the problem is.
  list($new_picture_width, $new_picture_height) = getimagesize($new_picture);

这就是代码回应的内容:

/tmp/phpSdyj9D 
Notice: getimagesize(): Read error! in /var/www/html/ch07.5/initial/mismatch/editprofile.php on line 54

我已经尝试了一切。我编辑了php.ini文件:

upload_max_filesize = 250M
post_max_size = 250M
max_execution_time = 300

date.timezone = "America/Los_Angeles"

这仍然没有奏效。我只更改了代码以获得不同的错误,如:

Fail to open stream.

由于所有这些混乱,图片仍然无法上传。

我希望我能得到一些帮助,看到互联网上的所有其他答案对我没有帮助。提前谢谢。

0 个答案:

没有答案