Manual:$wgHashedUploadDirectory

Details
If true, use the /a/ab/foo.png directory structure.

Note: This parameter can not be changed after the first image or file has been uploaded (or you need to move all previous uploaded pictures). It will result in php-errors (see the discussion page) if articles with the old logic try to find their pictures, since the image path is calculated an not stored in the database.