dongqiang8058 2017-02-16 22: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-16 22: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

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部