0

In my Angular directive, I'm trying to get the path to another folder outside of the project, that contains a bunch of files. The idea is to join that path with the list of files existent and draw them using the omnivorelibrary (It is not important here, but I'll leave the code for some context):

  var folderPath = "../../../traceMySteps-backend/MyTracks/ProcessedTracks/";

 return {

        restrict: 'E',
        scope: true,
        link: function($scope, $elem, $attr, $http) {

              for (var i = 0; i < jsonRes.length; i += 1) {
                console.log(folderPath + jsonRes[i])
                omnivore.gpx(folderPath + jsonRes[i]).addTo(trackmaps[trackmapCount]);
              }

...

The problem is that Angular thinks the folder is on the localhost: http://localhost:8000/traceMySteps-backend/MyTracks/ProcessedTracks/2016-05-04-‌​part1.gpx when the folder is outside this Angular project

The folder structure is:

Backend_folder/MyTracks/ProcessedTracks/
Angular_Project/app/js/directives/file

Backend_folder and Angular_Project are at the same level (both inside one folder). And in that file is where that directive code is. I need to access ProcessedTracks/ from it. Is there any way? This relative path does not work and I've also tried the absolute path, but the error is the same.

Daniel Lizik
  • 3,058
  • 2
  • 20
  • 42
Shoplifter.Doe
  • 118
  • 4
  • 16
  • Possible duplicate of [How do I serve static files through Node.js locally?](http://stackoverflow.com/questions/26145451/how-do-i-serve-static-files-through-node-js-locally) – Daniel Lizik Aug 02 '16 at 12:27

1 Answers1

0

This is not possible as the client (browser) doesn't have access to directory structure as this is a security risk. I think you can do this by installing some 3rd party tools on the server or exposing your files via a web service.

Umair Hafeez
  • 407
  • 2
  • 9