Manual:$wgHashedUploadDirectory

Details
If, uploaded files will be distributed into sub-directories of $wgUploadDirectory based on the first two characters of the md5 hash of the filename. (e.g. ) Creation of such subdirectories is handled automatically. If, all images are uploaded in $wgUploadDirectory itself. (e.g. )


 * This parameter should 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 and not stored in the database.