Advertisement
Guest User

Untitled

a guest
Feb 29th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $data = $_POST['data'];
  2. $servername = "localhost";
  3. $username = "kipkad_mage154";
  4. $password = "momoko123";
  5. $dbname = "kipkad_demo_kipcard";
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. $file_path = realpath("../media/rewardreceipt/");
  8. $base64img = str_replace('data:image/jpeg;base64,', '', $base64img);
  9. $data = base64_decode($base64img);
  10. $file = $file_path . uniqid() . '.jpeg';
  11. $success = file_put_contents($file, $data);
  12. if(move_uploaded_file($success, $file_path) {
  13. $arr = array('result' =>$file);
  14. echo json_encode($arr);
  15. } else{
  16. $arr = array('result' =>'false');
  17. echo json_encode($arr); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement