|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-07 01:39 UTC] sniper@php.net
[2005-08-07 19:28 UTC] mike dot norton at ultisearch dot co dot uk
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 11:00:01 2025 UTC |
Description: ------------ When using mysql with bind_params on blob data only the first 4 bytes of data get included. Reproduce code: --------------- <?php $mysqli = new mysqli("localhost", "user", "pass", "db"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $filename = "/path_to/files/5_copy14.jpg"; /* create a prepared statement */ $stmt = $mysqli->stmt_init(); $stmt->prepare("insert into user_image (image) values (?)"); $data = fread(fopen($filename, "rb"), filesize($filename)); $stmt->bind_param('b',$data); /* Prove that the $data variable contains the correct data */ print $data; $stmt->execute(); $stmt->close(); $mysqli->close(); ?> Expected result: ---------------- Image is displayed and image data is inserted into database Actual result: -------------- First 4K of image is inserted into database rest seems to be discarded