image not beimg saved to database through php
I am creating an android app and using php as my go between to my database. i am sending various text fields and an image. all the data gets in to my php but the image is not being saved to my database. im am storing ,my image in a medium blob.it always comes up [BLOB - 0KB]. the database does return a newid.
i can get it to save an image if i use the myadmin and do it manually but not throuth the code.
<?php
include("ConnectionInfo.php");
global $type;
global $id;
global $user_id;
global $meal;
global $scribble;
global $date;
global $taste;
global $feeling;
global $picture;
global $codedPic;
global $mealArray;
$type = $_REQUEST['type'];
$id = $_REQUEST['id'];
$user_id = $_REQUEST['user_id'];
$meal = $_REQUEST['meal'];
$scribble = $_REQUEST['scribble'];
$date = $_REQUEST['date'];
$dateLike = "{$_REQUEST['date']}%";
$taste = $_REQUEST['taste'];
$feeling = $_REQUEST['feeling'];
$picture = $_REQUEST['picture'];
$codedPic = base64_decode($picture);
$mealArray = array();
if ($type === "find")
{
$stmt=$conn->prepare("SELECT id,user_id,meal,comment,date,taste,feeling,mealPic FROM meals WHERE user_id = ? AND date like ?");
$stmt->bind_param('is',$user_id,$dateLike);
$stmt->execute();
$stmt->bind_result($idR,$user_idR,$mealR,$commentR,$dateR,$tasteR,$feelingR,$mealPicR);
$stmt->store_result();
while($stmt->fetch())
{
$meal = ['Id'=>$idR,'userId'=>$user_idR,'meal'=>$mealR,'scribble'=>$commentR,'time'=>$dateR,'taste'=>$tasteR,'feel'=>$feelingR,'ImageBase64'=>$mealPicR];
array_push($mealArray,$meal);
}
echo json_encode($mealArray);
}
else if ($type === "update")
{
$stmt = $conn->prepare('UPDATE meals SET meal = ?,comment = ?,taste = ?,feeling = ? WHERE id = ?');
$stmt->bind_param('ssiii',$meal,$scribble,$taste,$feeling,$id);
$stmt->execute();
echo $stmt->affected_rows;
}
else if ($type === "add")
{
//echo $picture;
$stmt = $conn->prepare('INSERT INTO meals (user_id,meal,comment,date,taste,feeling,mealPic) values(?,?,?,?,?,?,?)');
$stmt->bind_param('isssiib',$user_id,$meal,$scribble,$date,$taste,$feeling,$picture);
//$stmt->send_long_data(0,$codedPic);
$stmt->execute();
$stmt->store_result();
$stmt->fetch();
$newId = $conn->insert_id;
echo $newId;
}
?>