I have Data URI(image) and I am trying to save using php, my code is
$filename = 'test.png';
$fp = fopen("user_images/".$filename,"w");
fwrite($fp, base64_decode($_POST['strDataURI']));
fclose($fp);
It gives me corrupted image always, But i am getting right image when i use in Javascript
document.write('<img src="'+strDataURI+'"/>');