Add ajax check for file

Only issue I can see is that we don't perform JPath::clean() on the filename - which in some cases may lead to us having the wrong filename? But otherwise I think this works.