Location of the electron acceleration region in solar flares