我知道有数百个这样的问题,但我仍然无法理解如何插入和检索blob。
public function uploadContent($selectIDname, $incrementVersion, $data, $getAuthorID){
$dbManager = DatabaseConnectivityManager::getInstance();
$connection = $dbManager->getConnection();
$statement = mysqli_prepare($connection, static::$insertIntoFilescontent);
mysqli_stmt_bind_param($statement, "iisi",$selectIDname, $incrementVersion, $data, $getAuthorID);
$uploadFilescontent = mysqli_stmt_execute($statement);
mysqli_stmt_close($statement);
return $uploadFilescontent;
}
这就是我插入blob的方式($ data应该是blob但是在bind_param中我放b表中没有任何东西,所以我把它设置为字符串-s)。当用户登录时,他必须看到他所有上传的文件。 这是我尝试过的,但它没有用。
$type = $_FILES['uploadFile']['type'];
$sql = "SELECT fileContent FROM filescontent WHERE author='$getAuthorID'";
$query = mysqli_query($connection, $sql);
$row = mysqli_fetch_assoc($query);
$data = $row['fileContent'];
header("Content-type: $type");
print $data;