dongxie3352 2012-04-12 18:01
浏览 7

访问文档根目录外的文件 - 我能够压缩 - 无法显示

I have some images saved separately in folder outside the document root.

I write a program to zip those images using ZipArchive();

the php file is running inside sub folders of my document root.

i just give the outside image path as an array and pass it to zip object and works fine

$imgList = array(
    '/OUTSIDEFOLDER/img1.jpg',
     '/OUTSIDEFOLDER/img2.jpg'
);

same path i used to display the image in

<img src='/OUTSIDEFOLDER/img1.jpg'>

this is not working. What i am doing wrong . Is it a limitation of image source or

i have to look any config htaccess settings

  • 写回答

1条回答 默认 最新

  • dongzhiyong8577 2012-04-12 18:04
    关注

    The document root specifies what parts of your server's file system is available to be served up by the webserver.

    If you could just specify any path you wanted, anyone could steal anyfile they wanted from your server, etc..

    To serve something from outside the document root, you'll have to

    1. create an Apache alias that points to the file, so it effectively becomes "inside the document" root
    2. Create a filesystem symlink inside your document root that points to the external file, and make sure the webserver allows such symlinks and follows them
    3. Use a script (e.g. php) to serve up the file.
    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教