<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Access-Control-Allow-Headers,X-Auth-Token');
define('UPLOAD_DIR', './');
$image_code = $_POST['image'];
// $image_parts = explode(";base64,", $_POST['image']);
$image_parts = explode(";base64,", $image_code);
$image_type_aux = explode("image/", $image_parts[0]);
$image_type = $image_type_aux[1];
$image_base64 = base64_decode($image_parts[1]);
$file = UPLOAD_DIR . uniqid() . '.png';
file_put_contents($file, $image_base64);
//print_r($_POST) ;
echo $file;
?>
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Access-Control-Allow-Headers,X-Auth-Token');
define('UPLOAD_DIR', './');
$image_code = $_POST['image'];
// $image_parts = explode(";base64,", $_POST['image']);
$image_parts = explode(";base64,", $image_code);
$image_type_aux = explode("image/", $image_parts[0]);
$image_type = $image_type_aux[1];
$image_base64 = base64_decode($image_parts[1]);
$file = UPLOAD_DIR . uniqid() . '.png';
file_put_contents($file, $image_base64);
//print_r($_POST) ;
echo $file;
?>
Comments
Post a Comment