here is my upload code:
public function upload($id, $title, $year, $comments){
$imagedata = fopen($_FILES['up_images']['tmp_name'], 'rb');
$query = 'INSERT INTO uploads (uid, title, year, comments, image, image_name) VALUES (:uid, :title, :year, :comments, :image, :image_name)';
$statement = $this->db->prepare($query);
$statement->bindValue(':uid', $id);
$statement->bindValue(':title', $title);
$statement->bindValue(':year', $year);
$statement->bindValue(':comments', $comments);
$statement->bindValue(':image', $imagedata, PDO::PARAM_LOB);
$statement->bindValue(':image_name', $_FILES['up_images']['name']);
$statement->execute();
// return $imagedata
return $_FILES['up_images']['error'];
}
as you can see i returned ERROR and the actual IMAGE BUFFER
error = 0
returned raw buffer has all the raw image data
all my PARAMETERS pass and are successfully uploaded to the MYSQL db but the image data is NEVER passed: heres a screen of my PHPmyadmin
here is the table structure:
and here is my form:
<form action="digest.php" method="POST" id="up_form" enctype="multipart/form-data">
<input id="up_acct" name="up_acct" type="text" placeholder="Your ID" value="<?php echo $_GET['up_acct']; ?>" />
<input id="up_title" name="up_title" type="text" placeholder=" Title" value="<?php echo $_GET['up_title']; ?>" />
<input id="up_year" name="up_year" type="text" placeholder="Year" value="<?php echo $_GET['up_year']; ?>" />
<input id="up_images" name="up_images" type="file" accept=".jpg,.jpeg,.png,.gif,.svg" />
<textarea id="up_comments" name="up_comments" placeholder="COMMENTS (optional)" cols="22" rows="5"><?php echo $_GET['up_comments']; ?></textarea>
<input type="submit" name="up_submit" id="up_submit" value="UPLOAD">
the size of the image i am trying to upload is 80kb? ? ? ? ?
well below my php.ini settings.
my FILE DUMP shows all valid data including a valid temp directory and name and EVEN SIZE!
Am i missing some type of obscure configuration on mysql? php?
also - i cant store filepath name and retrieve from file system - part of a bigger project