|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-23 01:02 UTC] sniper@php.net
[2002-02-25 09:18 UTC] WPinegar at healthtech dot net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 07:00:01 2025 UTC |
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>