Welcome Guest, Not a member yet? Register   Sign In
Image uploading by api to android mobile
#1

Hi

   I had a issue regarding uploading a image from android mobile.The image is uploading and storing in database from website but not from mobile app.From mobile the image is not inserting into database .So,Please help me to resolve the issue.Thank you in advance.



Code in api in view
<?php 
require('includes/config.php');
$api = new Settings();
//echo "<pre>"; print_r($_FILES); die;
$mydb = new myDBC;
$api->validation('blank', array(user_id =>$json_parse_array[xxx]['user_id']));

$menu_id = $json_parse_array[xxxx]['menu_id'];
$category_id = $json_parse_array[xxxx]['category_id'];
$image = base64_decode($json_parse_array[xxxx]['pro_image']);
$is_active ='1';

$path = '../images/product/';
$fileName = 'products_'.time().'.jpg';
$final = $path.$fileName;

 file_put_contents($path . $filename, $image);

if(move_uploaded_file($_FILES['pro_image']['tmp_name'], $final)){
$file = 'http://xxxx.com/images/product/'.$fileName;
// $api->response(SUCCESS, "Find image name.", array('fileName'=>$file));
}
   
 $qry = "INSERT INTO `dz_products`(`menu_id`, `category_id`,`pro_image`,`is_active` ) 
VALUES('$menu_id','$category_id','$file','1')";
//print_r($qry);

    $result = $mydb->runQuery($qry);
    $result_array=array($result);
   
   
   
        $last_id = $mydb->lastInsertID();
Reply




Theme © iAndrew 2016 - Forum software by © MyBB