i just cleaned it up a bit

 <?
function edit_max_filesize($size){
  $filename = ".htaccess";
 $size = $size."M";
 $fd = fopen ($filename, "r+");
 flock($fd, LOCK_EX);
 while (!feof($fd)) {
  $fpos = ftell($fd);
  $c = fgetc($fd);
  if ($c == "M"){
   ftruncate($fd, $fpos-2);
   fseek($fd, -3, SEEK_CUR);
   fwrite($fd,'"'.$size.'"');
  }
 }
flock($fd, LOCK_UN);
fclose ($fd);
}
define('MAX_FILESIZE','5');
edit_max_filesize(MAX_FILESIZE);

?>

"Electroteque" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi guys i've managed to edit a htaccess file which will allow to override
> the upload_max_filesize ini setting which cannot be edited in php itself
> hope this helps, shure its a hack there could be anything with M in it,
i'm
> terrible at regex, so if anyone would like to add to it go ahead.
>
>  <?
>  $filename = ".htaccess";
> $fd = fopen ($filename, "r+");
> flock($fd, LOCK_EX);
> while (!feof($fd)) {
> $size="3M"; //whatever value u like in a defines
> $fpos = ftell($fd);
> $c = fgetc($fd);
> if ($c == "M"){
> ftruncate($fd, $fpos-2);
> fseek($fd, -3, SEEK_CUR);
> fwrite($fd,'"'.$size.'"');
> }
> }
> flock($fd, LOCK_UN);
> fclose ($fd);
> ?>
>
>



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

Reply via email to