0

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?

Aniket Sahrawat
  • 12,410
  • 3
  • 41
  • 67
Michael W.
  • 409
  • 7
  • 18
  • Provide some of the code you've written already. Also, how about some example inputs and desired outputs. – Daniel Nov 11 '16 at 20:26
  • It's literally just reading the variable from the controller using $file = json_decode($this->view_object_map['file']);, then trying to echo it out using echo ''; The input and the output are the same; a url that goes to a network drive. The exact urls are not relevant to the fact that I need spaces changed to %20 in an a tag. – Michael W. Nov 11 '16 at 21:24

1 Answers1

0

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.

Community
  • 1
  • 1
Michael W.
  • 409
  • 7
  • 18