I'm sending a base64 string from an Android app to a server through a PHP file.
I got this from a tutorial video:
<?php
require 'Init.php';
header('Content-type : bitmap; charset=utf8');
if(isset($_POST['encoded_string'])){
$encoded_string = $_POST['encoded_string'];
$image_name = $_POST['image_name'];
$decoded_string = base64_decode($encoded_string);
$path = 'ProfileIcons/' .$image_name;
$file = fopen($path, 'wb');
$is_written = fwrite($file, $decoded_string);
fclose($file);
}
?>
It's storing the image in the directory but when you open, it has no image. It's a blank png. Is there something wrong with the code? If so, what should I use? Thanks.