如何访问其他驱动器(xampp)中的源/上传文件?

时间:2016-08-26 14:24:58

标签: apache xampp

是否可以在htdocs中访问该网站并获取源代码或在其他驱动器中上传pdf / images(gif / png)?

例如: (C :)仍然在htdocs上运行

localhost/test/index.php

(F :) images / pdf存储在F:drive。

f:/test/images/foo.jpg

2 个答案:

答案 0 :(得分:0)

Apache应具有该文件夹的访问权限。最好的方法是将任何文件存储在与您的webroot文件夹相关的htdocs文件夹中。

您将使用服务器变量

获取文档根目录
  

$ _ SERVER [" DOCUMENT_ROOT"]

谢谢MG

答案 1 :(得分:0)

使用以下步骤解决了这个问题:

在以下位置添加文件夹名称“alias”:

C:\xampp\apache\conf\

添加别名文件夹后,将其添加到底部的“httpd.conf”中并保存。

Include "conf/alias/*"

现在创建* alias.conf“并将其保存到别名文件夹:。

<directory "c:\TEST">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #     Order allow,deny
    Allow from all
</Directory>

Alias /test "C:\TEST"