لدي سكربت يقوم بجلب الملف المراد تحميله بعد التاكد من ان المستخدم هو عضو فالموقع
الملفات موجودة في مجلد محمي بكلمة سر لمنع التحميل المباشر يعني الشخص فقط يستطيع التحميل عن طريق السكربت
الكود غال تمام والحمد لله لكن الملفات كبيرة الحجم يفصل الدونلود قبل انتهاء التحميل لا اعرف لقد بحثت كثيرا من دون جدوا
هذا هو الكود المستخدم
$
downloads = "downloads";
// Regular expression matching a safe filename.
// Filename must contain ONLY letters, digits, and underscores,
// with a single dot in the middle. NO slashes, NO double dots,
// NO pipe characters, nothing potentially dangerous.
// ^ matches the beginning of the string.
// \w matches a "word" character (A-Z, a-z, 0-9, and _ only).
// The "+" sign means "one or more."
// \. matches a single dot.
// And the final $ matches the end of the string.
$safeFilename = '/^\w+\.\w+$/';
// Now get the filename from the user
$filename = $_GET['filename'];
if ($filename == '') {
# We don't have a filename yet, so generate
# a file-picking menu page.
error("File does not exist");
} else {
# We have a filename, so download the file.
download();
}
function download()
{
global $filename, $safeFilename, $downloads;
// MAKE SURE THE FILENAME IS SAFE!
if (!preg_match($safeFilename, $filename)) {
error("Bad filename");
}
// Now make sure the file actually exists
if (!file_exists("$downloads/$filename")) {
error("File does not exist");
}
header("Expires: 0");
header("Content-disposition: attachment; filename=$filename");
header("Content-type: application/octet-stream");
readfile("$downloads/$filename");
// Exit successfully. We could just let the script exit
// normally at the bottom of the page, but then blank lines
// after the close of the script code would potentially cause
// problems after the file download.
exit(0);
}
function error($message) {
// You might want to output a more attractive error
// message page - hey, you're the web designer
?>
<html>
<head>
<title><?php echo $message?></title>
</head>
<body>
<h1><?php echo $message?></h1>
</body>
</html>
<?php
}
?>يا ريت تساعدوني يعني المشكلة اواجهها مع الملفات الكبيرة