buffer($unencoded); if(substr($infos,0,strpos($infos,'/')) !== "image"){ print encoding_normalize::json_encode(array('status' => 0, 'message' => "not an image")); //si ce n'est pas le cas, on ne va plus loin ! exit; } $fp = fopen($upload_filename, 'w'); if($fp) { fwrite($fp, $unencoded); fclose($fp); $status = 1; } } print encoding_normalize::json_encode(array('status' => $status, 'message' => $upload_filename));