<?php
/*$img = "";
$img = file_get_contents("uploadImages/imge.png");
echo $img; //for debugging..
//for running..
if(!$img) die("no data fetched");


$result = file_put_contents("billimage/test.png",$img);
if($result=== FALSE) 
  die("Error writing data into $target_path");
else
  echo "$result bytes written to $target_path";*/

function filesize_dir($file) {
        exec('dir ' . $file, $inf);
        $size_raw = $inf[6];
        $size_exp = explode(" ",$size_raw);
        $size_ext = $size_exp[19];
        $size_int = (float) str_replace(chr(255), '', $size_ext);
        return $size_int;
    }
$path = 'uploadImages/imge.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
//echo $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);	
	
	
	
//$imagedata = file_get_contents("uploadImages/imge.png");
             // alternatively specify an URL, if PHP settings allow
//$base64 = base64_encode($imagedata);
echo $base64=base64_encode($data);
$binary=base64_decode($base64);
echo "<br/> decodeed   ".$binary."<br/>";
//$binary=$base64;
//header('Content-Type: bitmap; charset=utf-8');
$file_nm='billimage/test.png';
$gfz =  filesize_dir($binary); 
echo "Filesize is ".$gfz;
$file = fopen($file_nm, 'w+');
fwrite($file, $binary);
fclose($file);
?>

