You are here: RE: [PHP] asking comment « PHP « IT news, forums, messages
RE: [PHP] asking comment

Posted by Jared Williams on 03/30/05 18:51

> JW> If want to create a unique filename, and are using PHP4.3.2 or
> JW> better, use fopen() with the 'x' or 'x+' mode, rather than
> JW> file_exists().
>
> If you're happy with your scripts generating E_WARNING's all
> over the place then yes. Personally, I'm not.

Use @ to surpress them.

You cannot guarentee the filename you think doesn't exist with the file_exists() doesn't exist when you eventually fopen() it,
otherwise. This problem falls into a category called "Race conditions". http://en.wikipedia.org/wiki/Race_condition and
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html.

Jared

 

Navigation:

[Reply to this 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

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