عرض مشاركة واحدة
قديم 06-23-2026, 12:02 PM   #1
admin
★ ZMZM ★
 
admin
 
تاريخ التسجيل: Jun 2005
المشاركات: 24
افتراضي مركز تحميل بدون قاعده بيانات وسهل التركيب خفيف ويوجد مثال

السلام عليكم ورحمة الله وبركاتة





أنشئ ملف index.php داخل: up

ونحط الكود كامل داخل ملف index.php

اقتباس:
<?php
$uploadDir = "uploads/";

if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0755, true);
}

$message = "";

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['image'])) {
$allowed = array('jpg','jpeg','png','gif');
$fileName = $_FILES['image']['name'];
$tmpName = $_FILES['image']['tmp_name'];
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

if (in_array($ext, $allowed)) {
$newName = time() . rand(1000,9999) . "." . $ext;
$target = $uploadDir . $newName;

if (move_uploaded_file($tmpName, $target)) {
$url = "https://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/uploads/" . $newName;

$message = '
<div class="success">
تم رفع الصورة بنجاح
<br><br>
الرابط المباشر:
<input type="text" value="'.$url.'" onclick="this.select();">
<br>
كود المنتدى:
<input type="text" value="[IMG]'.$url.'[/IMG]" onclick="this.select();">
</div>';
}
} else {
$message = '<div class="error">الصيغة غير مسموحة، المسموح JPG / PNG / GIF فقط</div>';
}
}
?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="utf-8">
<title>مركز تحميل النخبة</title>

<style>
body{
margin:0;
background:#e7dcc6;
font-family:Tahoma, Arial;
font-size:12px;
color:#4b3621;
}

.wrapper{
width:760px;
margin:25px auto;
background:#f8f1df;
border:1px solid #b49b72;
}

.header{
background:#d8c49b;
border-bottom:1px solid #b49b72;
padding:10px;
text-align:center;
}

.header h1{
margin:0;
font-size:24px;
color:#5b3b17;
}

.header span{
display:block;
margin-top:4px;
color:#7a5a2a;
font-weight:bold;
}

.banner{
text-align:center;
padding:12px;
background:#fff8e8;
border-bottom:1px solid #c7ad7d;
}

.banner img{
max-width:468px;
height:auto;
border:0;
}

.nav{
background:#b89458;
color:#fff;
padding:7px;
text-align:center;
font-weight:bold;
}

.nav a{
color:#fff;
text-decoration:none;
margin:0 10px;
}

.box{
margin:18px;
border:1px solid #b49b72;
background:#fffaf0;
}

.box-title{
background:#d8c49b;
padding:8px;
font-weight:bold;
color:#5b3b17;
border-bottom:1px solid #b49b72;
}

.box-content{
padding:20px;
text-align:center;
}

input[type=file]{
background:#fff;
border:1px solid #b49b72;
padding:6px;
width:330px;
}

input[type=submit]{
background:#8b5e23;
color:#fff;
border:1px solid #5b3b17;
padding:7px 28px;
cursorointer;
font-weight:bold;
}

input[type=text]{
width:90%;
margin-top:6px;
direction:ltr;
text-align:left;
padding:6px;
border:1px solid #b49b72;
}

.success{
margin:18px;
padding:12px;
background:#eef8df;
border:1px solid #7ca35c;
color:#2d5b12;
text-align:center;
}

.error{
margin:18px;
padding:12px;
background:#f8dddd;
border:1px solid #a94442;
color:#8a1f1f;
text-align:center;
}

.footer{
text-align:center;
padding:10px;
background:#d8c49b;
border-top:1px solid #b49b72;
color:#5b3b17;
}
</style>
</head>

<body>

<div class="wrapper">

<div class="header">
<h1>مركز تحميل النخبة</h1>
<span>ZMZM.NET Upload Center</span>
</div>

<div class="banner">
<a href="https://zmzm.net/vb">
<img src="banner.gif" alt="منتديات النخبة">
</a>
</div>

<div class="nav">
<a href="https://zmzm.net">الرئيسية</a>
|
<a href="https://zmzm.net/vb">منتديات النخبة</a>
</div>

<?php echo $message; ?>

<div class="box">
<div class="box-title">رفع صورة جديدة</div>
<div class="box-content">
<form method="post" enctype="multipart/form-data">
<p>اختر الصورة من جهازك</p>
<input type="file" name="image" required>
<br><br>
<input type="submit" value="رفع الصورة">
</form>
</div>
</div>

<div class="footer">
مركز تحميل النخبة - لحفظ صور أرشيف منتديات النخبة
</div>

</div>

</body>
</html>
بعدها:

أنشئ مجلد اسمه uploads داخل مجلد up.
أعطه صلاحية 755 أو 775.


افتح:
https://xxxxx.com/up

مثال لمركز التحميل
https://zmzm.net/up


رفع صور للمنتديات, تحميل الصور للمنتديات, صور vBulletin, مركز تحميل عربي مجاني, رفع الصور المتحركة GIF
admin غير متواجد حالياً   رد مع اقتباس