4

My php file is here: D:/Appserv/www/x/y/file.php

I want to load stuff from this folder: E:/foldie

I don't know what path will lead me there.

$somePath="HELP ME HERE!!!!"  
$dir=opendir($somePath);

//looping through filenames
while (false !== ($file = readdir($dir))) {
    echo "$file\n";
}
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
navand
  • 1,379
  • 1
  • 16
  • 20

2 Answers2

5

Use full Windows path to the file it should be working: "E:\folder\file.txt"

or just copy the file in the local/project directory for testing purpose.

Alex Rashkov
  • 9,833
  • 3
  • 32
  • 58
1

Set $somePath = "e:\\foldie". If that doesn't work, please indicate to us how it fails.

[Edit:: make sure you escape your backslashes in strings]

Mike
  • 23,542
  • 14
  • 76
  • 87
Paul Sonier
  • 38,903
  • 3
  • 77
  • 117