我正在使用cordova camera plugin
data_uri
选项从我的应用程序中拍照并保存。在服务器端,我得到了base64
编码字符串中的图像。但是保存了损坏的图像。但是我直接使用了base64编码的字符串,它在服务器端正确保存。
$image_code = $_REQUEST['imageCode']; $file = uniqid() . '.jpg'; $success = file_put_contents($file, base64_decode($image_code)); echo "uploaded";
如果我的实施有任何问题。感谢