Hello I'm trying to convert a base64 string to a image file, thats easy. Here is my code.
with open(os.path.join('avatars', avatar_filename), 'wb') as avatar_file:
avatar_file.write(base64.decodebytes(avatar_b64))
But the problem is that the string is sent by a client so, how can i know if the base64 string corresponds to a image file?