【发布时间】:2013-02-25 18:26:34
【问题描述】:
我更改了 php.ini 文件并在我的页面顶部添加了一个 set_time_limit(0),但我仍然无法使用 php 上传大文件。我也在使用 ajax 和 javascript 来上传,我可以上传 400Mb 的文件。我试图在 WAMP 上上传一个 3.2GB 的文件。
我的代码:
<?php
set_time_limit(0);
session_start();
include('../Connect/Connect.php');
$User = $_SESSION['User'];
$Files = $_FILES['File'];
if(isset($User))
{
if(!empty($Files))
{
for($X = 0; $X < count($Files['name']); $X++)
{
$Name = $Files['name'][$X];
$TMP = $Files['tmp_name'][$X];
move_uploaded_file($TMP, '../Users/' . $User . '/' . $Name);
}
}
}
else
{
header("location:../");
}
header("location:index.php");
$Connect->close();
?>
【问题讨论】:
-
所以您是说您可以在 5 分钟内上传 3.2 GB?如果是,那我真希望我有你的互联网连接......
-
这个问题应该有助于解释您可能遇到的问题。stackoverflow.com/questions/864570/very-large-uploads-with-php
-
对不起,我真的不应该那么讽刺。请检查 max_input_time ...
-
那么....当您尝试上传一个大文件而不是“它不起作用”时会发生什么?
-
检查您的 apache 错误日志。
标签: php javascript jquery ajax xmlhttprequest