dongqiang8058 2017-02-17 06:07 采纳率: 100%
浏览 38
已采纳

我的PHP文件上传脚本在文件大小> ~7.5MB时挂起,尽管改变了ini设置

I seem to be having problems with my upload script. If I upload a file around 6MB it works fine, but larger than that and it hangs. Here is the page with the upload form: https://amorphia-apparel.com/hirsute/info/upload/

Here are two files to test with, one 6.3MB one 8.8MB:

https://amorphia-apparel.com/carl-sagan-6MB.jpg

https://amorphia-apparel.com/carl-sagan-9MB.jpg

The smaller of the two works perfectly. The larger one, however, according to the chrome progress bar uploads in about 5-6 seconds, then the page hangs with "waiting for amorphia-apparel.com" indefinietly.

Here is my script:

    ini_set('memory_limit', '512M');
    ini_set('upload_max_filesize', '20M');
    ini_set('post_max_size', '20M');
    ini_set('max_input_time', 300);
    ini_set('max_execution_time', 120);

    $id = milltime();       

    if( !$_FILES['photo']['tmp_name'] ) return false;

    $extension = pathinfo( $_FILES['photo']['name'], PATHINFO_EXTENSION );
    $target_file = HOME_PATH . "images/user/temp/{$id}.{$extension}";

    if( !move_uploaded_file( $_FILES['photo']['tmp_name'], $target_file) ){      
          return false;
    }
    else {
          return true;
    }

Any clue what I did wrong?

  • 写回答

1条回答 默认 最新

  • duancan9815 2017-02-17 06:16
    关注

    You must set value of this settings in php.ini or httpd.conf or .htaccess. look here http://php.net/manual/en/ini.list.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效