在网络驱动器上以名称中的空格回显文件的URL

I have a view set up to dynamically fetch info about a file. This works pretty good. I also want to have a download link to the file in question, which exists on a network drive. I have been unable to figure out how to successfully echo out an <a> tag with the url correct.

Simply echoing out the tag puts the spaces, and so won't work (but curiously, if I copy the link location and just paste it in my browser, it works just fine).

str_replace(' ', '%20', $location)

gives me the same results as above.

rawurlencode($location) won't work because it appends the domain to the front of my url, and I'm linking to a network drive.

What's my best approach here?

I didn't realize it, but my question was related to this: Link to file on local hard drive

Bottom line: I'm bumping into a security feature of browsers (even though it's on a network drive, it's coming across as if it were a local file, and direct links to a local file are no-nos in modern browsers). I'll need to alter what I'm trying to do.