Given below is the PHP code for saving the graph as an image inside the folder. At Sreyas experienced PHP developers are available for customizing the requirements of clients.

$img_data = $_POST['data']; $id = $_POST['id']; $type= $_POST['type']; session_start(); $_SESSION['chart-image-'.$id] = $img_data; define('UPLOAD_DIR', 'graph'); //'Graph means your folder name' $base64img = str_replace('data:image/png;base64,', '', $img_data); $data = base64_decode($base64img); if($type!=='') { $file = UPLOAD_DIR .'/'.$id.'-'.$type.'.png'; file_put_contents($file, $data); } $review_file = UPLOAD_DIR .'/review-graph-'.$id.'.png'; file_put_contents($review_file, $data);
Leave a Reply