Reply to Re: [PHP] Re: file_exists()

Your name:

Reply:


Posted by "Richard Lynch" on 10/23/05 03:26

On Sat, October 22, 2005 7:12 pm, Jonny Bergström wrote:
> Good idea yes. But apparantly Windows couldn't do it either. :-(
>
> function file_exists_windows($path) {
> exec('dir ' . $path, $output, $return_status);
> return $return_status == 0 ? true : false; // Windows dir will return
> 0 when
> something was found
> }

First, I don't think $return_status is what you think it is.

$return_status is FALSE if your command is not syntactically valid.

It will be TRUE if your command is syntactically valid, but you'll
need to LOOK at $output to see if the file is listed or not.

> It works with "normal" ascii file names, but other than that it's a
> no.
> Makes you wonder what the problem is here, maybe exec() not supporting
> unicode either.

If the filename is funky, you are going to have to do whatever you
would do in a DOS prompt to escape it, munge, or otherwise convert it
to whatever that version of Windows uses.

Inlucding 8.3 on ancient Windows, if PHP runs on that junk.

--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация