警告:getimagesize(upload / 18.jpg)[function.getimagesize]:无法打开流:没有这样的文件或目录

时间:2015-10-04 20:10:41

标签: php getimagesize

错误发生在第27行" getimagesize"功能,我上传图像在相同的"路径" ,但是当我继续操作时,我每次都会收到此错误,以及图像正常的文件夹的路径

PHP     //连接到数据库

$link = mysql_connect("localhost" , "333" , "3333")
    or die( "could not connect " . mysql_error() );
mysql_select_db("moviesite" , $link)
    or die ( mysql_error() );

// make variables available
$id = $_REQUEST['id'];
if (isset($_REQUEST['mode']))
{
    $move = $_REQUEST['mode'];
}
else
{
    $mode = '' ;
}

    // get info on the pic we want
$getpic = mysql_query("SELECT * FROM images WHERE image_id = '$id' ")
            or die( mysql_error() ) ;
        $rows = mysql_fetch_array($getpic);
        extract($rows);
    $image_filename = "upload/" . $image_id . ".jpg" ;

    list($width, $height, $type, $attr) = getimagesize($image_filename);

1 个答案:

答案 0 :(得分:0)

首先尝试检查文件是否存在:

if (!file_exists($image_filename)){
    echo "file not found!";
    exit;
}