prova a specificare il tipo di file:

...data:image/jpg;base64, ...