Fixed a bug in the code that I missed when checking.

Replaced file.getAbsolutePath() with file.getName() as we don't want the full path at that point!