The file's last two pages is how you'd phrase it - the noun phrase that's possessed by the file is last two pages. If you split that phrase up, into last two and pages, it sounds strange.
And by saying the last two file's pages, it sounds more like you're talking about the pages belonging to the last two files, that last two determiner has attached itself to file's instead. The apostrophe doesn't fit (it should be files') so that's a clue that something's wrong, but you can't hear apostrophes, and if you said that out loud it would sound like *the last two files' pages", i.e. (all) the pages from the last two files.
The last two pages of the file is perfectly fine, you've just moved the entire last two pages noun phrase to another position, but kept it intact. Either that or the file's last two pages is completely fine and clear!