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 <[EMAIL PROTECTED]> 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
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to