【问题标题】:PHP Problem uploading files with drag and dropPHP问题通过拖放上传文件
【发布时间】:2011-05-12 07:34:28
【问题描述】:

我正在使用 HTML5 拖放功能上传文件。它显示上传文件的百分比。

在我的测试环境中。我可以从字面上看到文件被复制到服务器上。例如,如果我上传 200M 文件,我可以看到临时文件正在创建并逐渐变大。

但是在 Prod ENV 上。它只是复制整个文件。

我是否缺少服务器 apache 或 php 配置中的任何内容。以下是逐步写入文件的示例代码。

    $input = fopen("php://input", "r");
    //$temp = tmpfile();
    $target = fopen($path, "w");
    $realSize = stream_copy_to_stream($input, $target);
    fclose($input);
    fclose($target);
    if ($realSize != $this->getSize()){
        return false;
    }

【问题讨论】:

    标签: php file-upload drag-and-drop


    【解决方案1】:

    PHP 本身不支持渐进式上传。您需要 http://pecl.php.net/package/uploadprogress 或 APC,如本文所说的 http://www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-18
      • 2020-05-10
      • 2010-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多