Yeah here's a bit of my code, because I think more people will be looking for this...

Of course I make sure the fileName is nicely formatted first. I do that using this function: make-a-safe-url It may be for urls, but works great for making sure filenames are formatted correctly as well.