Question

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)?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top