[PHP] Re: upload_max_filesize

2006-01-24 Thread David Robley
Daniel Lahey wrote:

 A client has started experiencing problems with uploading files
 larger than the default 2M set in php.ini.  The problem only started
 occurring a few weeks or so ago, and I cannot figure out how to get
 around it.  I have a php.ini file in the /public_html folder that reads:
 
 post_max_size 8388608
 upload_max_filesize 8388608
 
 I've also tried peppering the code with calls to ini_set
 ('upload_max_filesize', '8388608');   In desparation, I've also tried
 a .htaccess file that reads:
 
 IfModule mod_php5.c
  php_value upload_max_filesize 8388608
 /IfModule
 IfModule mod_php4.c
  php_value upload_max_filesize 8388608
 /IfModule
 
 Nothing seems to work.  This didn't used to be a problem.  I can
 upload files smaller than 2M just fine.  Any ideas?
 
 TIA

Have you checked the value for MAX_FILE_SIZE in the upload form?


Cheers
-- 
David Robley

Someone threw a beer at Clinton. He dodged it. No doubt a draft.

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



[PHP] Re: upload_max_filesize hack

2002-12-24 Thread electroteque
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