From: Geoffrey T. D. <da...@us...> - 2001-11-17 16:39:11
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv29250/lib Modified Files: Request.php Log Message: Fix file upload bug. Index: Request.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/Request.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Request.php 2001/09/19 02:58:00 1.2 --- Request.php 2001/11/17 16:39:08 1.3 *************** *** 239,246 **** function open() { if ( ($fd = fopen($this->_info['tmp_name'], "rb")) ) { ! // Dump http headers. ! while ( ($header = fgets($fd, 4096)) ) ! if (trim($header) == '') ! break; } return $fd; --- 239,262 ---- function open() { if ( ($fd = fopen($this->_info['tmp_name'], "rb")) ) { ! if ($this->getSize() < filesize($this->_info['tmp_name'])) { ! // FIXME: Some PHP's (or is it some browsers?) put ! // HTTP/MIME headers in the file body, some don't. ! // ! // At least, I think that's the case. I know I used ! // to need this code, now I don't. ! // ! // This code is more-or-less untested currently. ! // ! // Dump HTTP headers. ! while ( ($header = fgets($fd, 4096)) ) { ! if (trim($header) == '') { ! break; ! } ! else if (!preg_match('/^content-(length|type):/i', $header)) { ! rewind($fd); ! break; ! } ! } ! } } return $fd; |