dongyin2390 2016-11-11 20:22
浏览 53
已采纳

在网络驱动器上以名称中的空格回显文件的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?

  • 写回答

1条回答 默认 最新

  • drctyr2869 2016-11-14 16:51
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?