PHP头条
热点:

php无法上传大文件的解决方法


  1. <form enctype="multipart/form-data" action="add_file.php" method="post">  
  2. <fieldset><legend>Fill out the form to upload a file:</legend>  
  3. <?php // Create the inputs.  
  4. for ($i = 0; $i < $counter; $i++) {  
  5. echo '<b>File:</b> <input type="file" name="upload' . $i . '" />  
  6.   
  7. <b>Description:</b> <textarea name="description' . $i . '" cols="40" rows="5"></textarea>  
  8.   
  9.   
  10. ';  
  11. }  
  12. ?>  
  13. </fieldset>  
  14. <input type="hidden" name="submitted" value="TRUE" />  
  15. [align=center]<input type="submit" name="submit" value="Submit" />[/align]  
  16. </form>  
在实际执行过程中发现上传稍微大一些的文件时,显示File couldn't be moved。 
数据库里显示文件名称,不显示大小。 
而上传大于8M的文件时,页面根本没有反应。 

网上找到几篇文章: 
解决PHP上传大文件的问题 
php设置允许大文件上传的方法 
apache+php上传大文件 
php上传大文件时php.ini的几处设置 

以上文章均指出是因为:php的文件上传受到了php.ini如下设置的影响: 
  1. post_max_size  
  2. upload_max_filesize  
  3. max_execution_time  
  4. memory_limit  
于是,找到 /etc/php5/apache2/,在其下找到php.ini,查找post_max_size,将其默认值修改为125M; 
查找upload_max_filesize,将其默认值修改为125M,然后保存。 
在终端输入:apache2ctl -k restart 重启apache,问题成功解决了。

www.phpzy.comtrue/php/6710.htmlTechArticlephp无法上传大文件的解决方法 formenctype= "multipart/form-data" action= "add_file.php" method= "post" fieldsetlegendFillouttheformtouploadafile:/legend ?php //Createtheinputs. for ($i= 0 ;$i$counter;$i++){ echo 'bFile:/binputtype...

相关文章

相关频道:

PHP之友评论

今天推荐