我正在为售后客户服务企业制作内联网.员工需要能够将img文件上传到Intranet的服务器,我需要将它们存储在BEFORE www(网站的根目录)的目录中.
使用php执行此操作非常简单,但如果在上传后如何将这些imgs包含在网站上?我试过这段代码
<img src="../img/img.png"/>
Run Code Online (Sandbox Code Playgroud)
这是行不通的,因为如果文件位于服务器www目录的外面,我就无法发送文件...
有没有正确的方法呢?
当前树视图:
server root directory
|www
|(all server files)
|img
|(all img files)
Run Code Online (Sandbox Code Playgroud)
(服务器的index.php位于,www文件位于img)
在这个项目中,我将管理员提交的文件上传到公共文件夹之外的文件夹。
/web/ (the public folder)
/upload/ (uploading image to this which is at the same level as the public folder)
Run Code Online (Sandbox Code Playgroud)
现在虽然我可以使用绝对 url ( /www/userid/upload/)上传,但我无法使用相对或绝对 url 回显相同的图像。
我也试过<img src="/www/userid/upload/photo.jpg" />,<img src="../upload/photo.jpg" />但没有一个工作。任何提示?