【问题标题】:Saving Image in Blob Format (On converting in blob format is getting wrong)以 Blob 格式保存图像(以 Blob 格式转换时出错)
【发布时间】:2021-05-23 01:32:50
【问题描述】:

在转换 blob 格式的图像时出现格式错误且 mysql 不允许打开出现错误不是有效格式。

$filePath = $targetDir."/".$_FILES['productimage']["name"];
$photopath1 = $_FILES['productimage']["name"];
$blobImg=addslashes(file_get_contents($_FILES['productimage']["tmp_name"]));
                    
if(!move_uploaded_file($_FILES['productimage']["tmp_name"], $filePath)){    
        return false;
}

【问题讨论】:

    标签: php blob


    【解决方案1】:
    $filePath = $targetDir."/".$_FILES['productimage']["name"];
    $photopath1 = $_FILES['productimage']["name"];
    $check=($_FILES['productimage']["tmp_name"]);
    
    $imageData = file_get_contents($_FILES["productimage"]["tmp_name"]);
    
              
    if(!move_uploaded_file($_FILES['productimage']["tmp_name"], $filePath)){
        return 1;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-09-15
      • 2020-08-02
      • 2018-08-26
      • 2019-12-21
      • 2019-04-16
      • 1970-01-01
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多