2

I created a folder through Windows Explorer, but is_dir returns FALSE.

A path that fails:

ficheiros/dinamicos/multimedia/imagem/areas/galerias/actividades/professores/iii-xxxxxxxx-xxxxxxxx-xx-xxxxxxxxxxx-xxx-xxxxxxxx-abcdefg/__fmhidden__681d75e470b4fd52f7d3b468b8ce7b5b/__fmhidden__b14a7b8059d9c055954c92674ce60032

This one doesn't fail:

ficheiros/dinamicos/multimedia/imagem/areas/galerias/actividades/professores/iii-xxxxxxxx-xxxxxxxx-xx-xxxxxxxxxxx-xxx-xxxxxxxx-a/__fmhidden__681d75e470b4fd52f7d3b468b8ce7b5b/__fmhidden__b14a7b8059d9c055954c92674ce60032

My code used to work flawlessly for months. After debugging it, I found that the problem was with mkdir/is_dir. The strange part is that it only happens when the path length was bigger than 218 characters (247 as absolute).

Is there any limit to the path length for is_dir and mkdir (in Windows environments)?

Pacerier
  • 86,231
  • 106
  • 366
  • 634
MJC
  • 3,871
  • 4
  • 23
  • 34

1 Answers1

1

In Windows the character limit of file paths is 260 (with some exceptions) so the PHP mk_dir and is_dir functions may not work as you expect.

See: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

  • thank you. That should be the issue. It isn't that problematic since it will only be deployed in unix systems – MJC Sep 13 '13 at 20:39