Web: check preview file names

Now raises appropriate errors if the filename is invalid
or the preview files is not present.