How to save a picture in database sent from android by base64 encoding through PHP? -


i doing project part of includes sending captured image server. using 000webhost server. android app capture image , send server through php. me please available resource/link/code/example how save picture in database. can apply several operation or queries on that. checking app temporarily have aploaded pictures being saved in folder of server. code follow, doing job:

`

     // connecting db     $db = new db_connect();     error_reporting(e_all);     if(isset($_post['imagename'])){     $imgname = $_post['imagename'];     $imsrc = base64_decode($_post['base64']);     $fp = fopen($imgname, 'w');     fwrite($fp, $imsrc);     if(fclose($fp)){       echo "success uploading image";       }else{           echo "error uploading image";        }       }     ?>`  

you can save image path in data base or can save base64 itself, base64 string. note base64 long string, have in mind when create column save info. can see this.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -