Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = $_POST['data'];
- $servername = "localhost";
- $username = "kipkad_mage154";
- $password = "momoko123";
- $dbname = "kipkad_demo_kipcard";
- $conn = new mysqli($servername, $username, $password, $dbname);
- $file_path = realpath("../media/rewardreceipt/");
- $base64img = str_replace('data:image/jpeg;base64,', '', $base64img);
- $data = base64_decode($base64img);
- $file = $file_path . uniqid() . '.jpeg';
- $success = file_put_contents($file, $data);
- if(move_uploaded_file($success, $file_path) {
- $arr = array('result' =>$file);
- echo json_encode($arr);
- } else{
- $arr = array('result' =>'false');
- echo json_encode($arr); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement