From:             [EMAIL PROTECTED]
Operating system: Windows 2000 Server
PHP version:      4.1.1
PHP Bug Type:     IIS related
Bug description:  File uploads causes PHP to consume too much CPU time

If I upload a large file to a PHP web page I noticed the upload consumes
100% of the cpu on the IIS server.  It sounds like there is a very small
buffer being allocated in PHP for the file writing.  Is there any way to
adjust this so that PHP can accept large HTML POSTs without consuming so
much CPU time?

Attached is php code that will allow you to duplicate the problem:

----------------------------------

<HTML>
<TITLE>
File upload
</title>
<body>

<B>File upload</b>

<form enctype="multipart/form-data" action="upload.aspx" method="post">

<!-- "MAX_FILE_SIZE" determines the biggest size an uploaded
file can occupy -->

<input type="hidden" name="MAX_FILE_SIZE"
value="500000000">
Send this file: 
  <input id="File1" name="File1" type="file"><br><br>
<input type="submit" name="submit" value="Send
File">
</form>

</body>

<?PHP

/*  

$userfile - The temporary filename in which the uploaded file was stored
on the server machine. 

$userfile_name - The original name or path of the file on the sender's
system. 

$userfile_size - The size of the uploaded file in bytes. 

$userfile_type - The mime type of the file if the browser provided this
information. An example would be "image/gif". 
  
*/

// copy to this directory

$dir="c:\\Uploads\\";

  
// copy the file to the server

if (isset($submit)){

        copy($userfile,$dir.$userfile_name);    
        
        if (!is_uploaded_file ($userfile)){
        
                echo " <b>$userfile_name</b> couldn't be copied
!!";
        }
}

// check whether it has been uploaded

if (is_uploaded_file ($userfile)){

        echo " <b>$userfile_name</b> copied succesfully
!!";
        
}

?>

</html>
-- 
Edit bug report at http://bugs.php.net/?id=15681&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15681&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15681&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15681&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15681&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15681&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15681&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15681&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15681&r=submittedtwice

Reply via email to