我有一个脚本,允许用户下载文件大小> 250MB 的文件。当文件大小 < 100MB 时,可以下载。但不适用于大于 250 MB 的文件。
I have changed the setting in php.ini:
memory_limit = 12800M
post_max_size = 8000M
upload_max_filesize = 2000M
max_execution_time = 512000
但它仍然不可行。如何使我可以下载> 250MB的文件?
更新:下载 zip 文件的代码
ini_set('max_execution_time', 512000);
$file_folder = "image/data/"; // folder to load files
$zip = new ZipArchive(); // Load zip library
$zip_name = "image.zip"; // Zip name
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){ // Opening zip file to load files
echo "* Sorry ZIP creation failed at this time<br/>";
}
$dir = opendir ("image/data");
$counter = 0;
while (false !== ($file = readdir($dir)))
{
if($file == '.' || $file == '..')
{ }else
{
$zip->addFile($file_folder.$file, $file);
}
}
$zip->close();
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
header('Content-Length: ' . filesize($zip_name));
readfile($zip_name);
// remove zip file is exists in temp path
unlink($zip_name);