简体   繁体   中英

access to the root folder for client side

I'm new in the development of server-side applications. I have a collection in mongodb which stores names of files that store in the root directory /uploads . I have to download them on client side using the angular. But using the ng-src or simple src out of ng-repeat I get a 404 error. Is there any way to get the client-side access to the directory with the files?

<div class="row jumbotron" ng-repeat="item in items">
    <div class="col-sm-1">
        <img ng-src="../../../uploads/{{item.logo}}">
    </div>
    <div class="col-sm-8">
        <h4>{{item.name}}</h4>
    </div>
    <div class="col-sm-2 pull-right">
        <button type="button" class="btn btn-lg btn-info" ng-click="showModal($index)">Edit</button>
    </div>
</div>

应用架构

Also tried to provided file through ../ - 404 (Not Found)

<div>
    <img src="../../../uploads/38809344bac1a3a77c5d1e0493763849.png">
</div>

The path you provided will go up three folders and then will look for the uploads folder, as each ../ means: Go up one level ( relative path notation ). If this is not the case, please update the question with a sample of your folder structure. Relative paths start from the current folder in which your HTML file resides on the server.

Another point to keep in mind: If you're using Linux , The privileges of the /uploads folder must allow the application to access it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM