You are trying to save Base 64 data directly to a file. The Cropit "export" function returns data in DataURI format which has the real binary data encoded in Base 64.
You code is alright up to the point you are trying to save the data to a file. Use a Base 64 decoder to decode it first before saving.