public function getFileLocation($file)
    {
        // get the file info
        if (filter_var($file, FILTER_VALIDATE_URL)) { 

            // the file is a URL, download it and set the local file path
            $localFile = '/tmp/moltinfile_' . rand(100000, 900000);
            file_put_contents($localFile, file_get_contents($file));
        } else {

            // the file is stored locally, set it
            $localFile = $file;
        }

        // be sure it exists
        if (!file_exists($localFile)) {
            throw new FileNotFoundException();
        }

        return $localFile;
    }