Update file.php

Same fix like #3448 for Joomla 2.5.x
Change process flow

Fix process flow as noticed by @wilsonge on https://github.com/joomla/joomla-cms/pull/3448
Merge pull request #3449 from zero-24/patch-11

[#33614] Fix file.php in Joomla 2.5.x