【发布时间】:2014-02-16 07:36:39
【问题描述】:
我正在使用 codeigniter,以下代码已经运行了很长时间,直到我的服务器更新到 PHP 5.4。我的要求是允许上传大型文件并将它们作为 blob 保存在 mysql 数据库中。我无法存储链接引用,所以这不是一个选项。
下面是我的代码。我得到的错误是
Message: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given
从外观上看,我通过引用传递所有内容。
任何帮助都会很棒。
function UploadFile($filepath, $contenttype, $fileext, $filename, $filesize)
{
$stmt = $this->db->call_function('stmt_init',$this->db->conn_id);
if($this->db->call_function('stmt_prepare',$stmt, 'INSERT INTO THE_TABLE (user_id, upload_description, upload, content_type, file_ext, file_name, file_size) VALUES(?,?,?,?,?,?,?)'))
{
$clientId = $this->input->post('clientid');
$desc = $this->input->post('uploaddescription');
$userfile = $this->input->post('userfile');
$param = 2;
$chunkSize = 8192;
$this->db->call_function('stmt_bind_param',$stmt, "isbssss", $clientId, $desc, $userfile, $contenttype, $fileext, $filename, $filesize);
if ($fp = @fopen($_FILES['userfile']['tmp_name'], 'r'))
{
while (!feof($fp))
{
$this->db->call_function('stmt_send_long_data',$stmt, $param, fread($fp, $chunkSize));
}
fclose($fp);
}
$result_query = $this->db->call_function('stmt_execute', $stmt);
【问题讨论】:
标签: php mysql codeigniter mysqli blob