You are here: Re: [PHP] fwrite/fopen « PHP « IT news, forums, messages
Re: [PHP] fwrite/fopen

Posted by Mister Jack on 09/28/92 11:18

fwrite failed for "quota disc exceeded", so I end up with empty file.

the algorithm is something like :

if (! $fp = @fopen($config['pagecachedir'].$path.$tmp_value,'wb')) {
$errorLog .= "Writing problem for ".$config['pagecachedir'].
"$path$tmp_value!\n";
} else {
$txt_length = strlen($txt);
if (@fwrite($fp,$txt,$txt_length) != $txt_length) {
$errorLog .= "Writing problem in file !\n";
@fclose($fp);
@unlink($config['pagecachedir'].$path.$tmp_value);
} else {
//everything is OK
@fclose($fp);
}


On 6/11/05, Richard Lynch <ceo@l-i-e.com> wrote:
>
> You would probably have to fclose it before you can unlink it, and if it's
> fargled enough that fwrite failed, you probably can't fclose it
> successfully...
>
> Your best bet would be to put the filename into a database table, then run
> a cron job that deletes all the files in that table, and only takes them
> out of the table if they are successfully deleted.
>
> Course, you then want to be sure you have UNIQUE filenames so you don't
> delete a good file later.
>
>
>
> On Fri, June 10, 2005 4:03 pm, Mister Jack said:
> > Hi,
> >
> > I having a problem at the moment, I open a file, try to write in it,
> > and then remove the file if the write goes wrong (if write count != of
> > my initial buffer length). But I still get some empty file (and then a
> > blank page). Could possibly fopen (with a 'wb' flag, and under freebsd
> > 4.11) failed but still create that empty file ?
> >
> > Where could I get more info on the behavior of fopen/fwrite ?
> >
> > Thanks for your help.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>

 

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

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