An active region filament studied simultaneously in the chromosphere and photosphere - I. Magnetic structure