Drop the input['type'] = file check on toData as it overrides the images data