PHP + Uploadify + MySQL上传大文件出现HTTP Error (500)

网页代码,装入Uploadify控件:

<script src="uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="uploadify/swfobject.js" type="text/javascript"></script>

<div id ='divFileUpload' class='div6' style='padding:5px' >

<div class='span3A' onclick="GetMyFileProcessStatus()" title='Click here to get file processing status' >Click (+) to upload cad file (*.zip;*.rar;*.tgz)<hr /></div>
<input id="file_upload" name="file_upload" type="file" multiple="true" /> 
<div id='div_fileuploadstatus'></div>
<div id='divfileQueue'></div>
<div id='divFileList' >File list</div>
<div id='divFileInfo' ></div>

</div>

uploadify: http://www.uploadify.com/demos/

问题:大文件上传,错误

Uploadify small file to MySQL, good;  (3M小文件上传,没有问题)

 

Uploadify big file to MySQL, error: (100M大文件上传,错误)

 

 思路:

  • 1)可能在某个地方设定了限定上传文件大小
  • 2)上传文件需要时间,可能在某个地方设定了限定上传文件的时间

1. 检查PHP ini  (问题在于PHP配置文件设定里)

echo ini_get('upload_max_filesize')."<br />";

>2048M   (此设置没有问题)

echo ini_get('post_max_size');

>1024M   (此设置没有问题)

max_execution_time = 300 改为 3000

max_input_time = 60           改为 600

memory_limit = 128M          改为 1280M

(after change to the red, restart IIS …. upload big file …. 修改以上参数之后,上传文件就没有问题了)

2. 检查mysql 设置(没有问题)

mysql> show VARIABLES like'%max_allowed_packet%';

+--------------------------+------------+

| Variable_name            | Value      |

+--------------------------+------------+

| max_allowed_packet       | 1073741824 |

| slave_max_allowed_packet | 1073741824 |

+--------------------------+------------+

2 rows in set (0.00 sec)

3. 检查IIS configuration  (IIS配置,没有问题)

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

   <system.web>

     <compilation debug="true" targetFramework="4.5" />

     <!--maxRequestLength就是文件的最大字符数,最大值不能超过2个G左右,executionTimeout是超时时间-->

     <httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" />

   </system.web>

  

    <system.webServer>

        <handlers accessPolicy="Read, Execute, Script">

            <remove name="perlFastCgiModule" />

            <add name="perlFastCgiModule" path="*.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Perl64\bin\perl.exe &quot;%s&quot; %s" resourceType="Either" requireAccess="Script" />

        </handlers>

       

        <security>

          <requestFiltering allowDoubleEscaping="true">

            <requestLimits maxAllowedContentLength="1073741824"/>

            <fileExtensions allowUnlisted="true"/>

            <verbs allowUnlisted="true"/>

          </requestFiltering>

        </security> 

                 

    </system.webServer>

</configuration>

 

4. 检查PHP ini设置

echo ini_get('upload_max_filesize')."<br />";

>2048M

echo ini_get('post_max_size');

>1024M

max_execution_time = 300 改为 3000

max_input_time = 60           改为 600

memory_limit = 128M          改为 1280M

(after change to the red, restart IIS …. upload big file …. good! 修改以上参数之后,上传文件就没有问题了)

 

猜你喜欢

转载自www.cnblogs.com/LuoYueRen/p/10135251.html