write uploaded content as file if filename provided