Sanitizing uploaded filenames and fix to caching API queries.

Now sanitizing filenames on upload before the files are written to disk.  Created subroutine so that filenames created from uploading and from extracting an archive have their filenames sanitized by one piece of code.

Also, fixed caching for API queries