اخي
لو تكرمت ممكن تعدل على هذا السكربت بمايناسب .. ولو كان هذا الامر شاق عليك فكأني لم اطلبة منك فعذني اخي وجزيت خيرا ً :shy:
كود PHP:
///////////////////////////////////////// upload start here //////////////////////////////////////
case "upload":
//Absolute path to where files are uploaded.
$absolute_path = "images/usersimages/";
//do you want a size limit yes or no.
$size_limit = "yes";
//How big do you want size limit to be in bytes.
$limit_size = "150000";
//List extensions you want files uploaded to be.
$extensions = array(".gif", ".jpg", ".jpeg", ".png");
if(!$vboptions['allowedmisc'])
{
echo "
<HTML id=dlgImage dir=\"rtl\">
<head>
<title>رفع الصور - $vboptions[bbtitle]</title>
<style>
html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
</style>
</head>
<body style=\"background: threedface; color: windowtext;\" scroll=no>
<center><br><br><font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>تم تعطيل رفع الصور من قبل المشرف العام.</B></font></center><br>
<center><BUTTON onClick=\"window.close();\">عوده</BUTTON></center><br>
</body>
</html>";
exit;
}
if($_REQUEST['action'] != 'doupload'){
echo "<HTML id=dlgImage dir=\"rtl\">
<head>
<title>رفع الصور - $vboptions[bbtitle]</title>
<style>
html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
</style>
<SCRIPT>
window.name = \"poem\";
</SCRIPT>
</head>
<body style=\"background: threedface; color: windowtext;\" scroll=no>
<FIELDSET id=fldSpacing style=\"left: 1.2em; top: 0.7em; width: 31.3em; height: 6.6em;\">
<LEGEND>ملف الصوره الذي تريد رفعه</LEGEND>
</FIELDSET>
<FIELDSET id=fldSpacing style=\"left: 1.2em; top: 7.9em; width: 31.3em; height: 5.5em;\">
<LEGEND>يجب تطبيق الشروط التاليه:</font></LEGEND>
</FIELDSET>
<div style=\"left: 0.2em; top: 9.9em; width: 31.3em; height: 5.5em;\">
<ul type=\"square\">
<li>إمتداد الملف يجب أن يكون أحد: ";
if (($extensions == "")) {
echo "أي إمتداد";
} else {
foreach ($extensions AS $ext)
echo "<b> $ext</b>";
}
if (($limit_size == "") or ($size_limit != "yes")) {
$limit_size = "أي حجم";
} else {
$limit_size .= " بايت";
}
echo"
</li>
<li>أقصى حجم للملف $limit_size</li>
</ul>
</div>
<form target=\"poem\" method=\"POST\" action=\"poem.php\" enctype=\"multipart/form-data\">
<p align=\"center\">
<input type=\"hidden\" name=\"type\" value=\"upload\">
<input type=\"hidden\" name=\"action\" value=\"doupload\">
<input type=file name=file size=30 style=\"left: 1.8em; top: 2.2em; width: 30em; height: 2.1294em; ime-mode: disabled;\" tabIndex=10><br>
<br>
<input name=\"submit\" type=\"submit\" value=\"رفـــع\" style=\"left: 12.8em; top: 4.7em; width: 7em; height: 2.1294em; ime-mode: disabled;\" tabIndex=10>
</p>
</form>
</body>
</html>";
}elseif($_REQUEST['action'] == 'doupload'){
$err_result = 0;
if($bbuserinfo['usergroupid'] == 0 || $bbuserinfo['usergroupid'] == 1 || $bbuserinfo['usergroupid'] == 3 || $bbuserinfo['usergroupid'] == 4 ){
$err_result = 1;
$endresult = "<BR><BR><font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>خطأ: يجب أن تكون مشارك.</B></font>";
}elseif($bbuserinfo['posts'] < 10){
$err_result = 1;
$endresult = "<BR><BR><font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>خطأ: يجب أن لا تقل مشاركاتك عن 10 مشاركات.</B></font>";
}else{
if ($size_limit == "yes" && $limit_size < $_FILES['file']['size'] && $_FILES['file']['size'] != 0) {
$endresult = "<BR><BR><font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>خطأ: حجم الملف زائد عن الحجم المسموح به.</B></font>";
$err_result = 1;
} else {
$ext = strrchr($_FILES['file']['name'],'.');
if (!in_array($ext,$extensions)) {
$endresult = "<BR><BR><font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>خطأ: إمتداد هذا النوع من الملفات غير مسموح به.</B></font>";
$err_result = 1;
}else{
$file_name = $bbuserinfo['userid']."_".time().$ext;
if(!copy($_FILES['file']['tmp_name'], "$absolute_path/$file_name")){
$endresult = "<font size=\"2\"><IMG SRC=\"../images/toolbox/error.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>خطأ: غير قادر على رفع الملف.</B></font>";
$err_result = 1;
}
}
}
}
if($err_result == 0){
$endresult = "<BR><BR><font size=\"2\"><IMG SRC=\"../images/toolbox/success.gif\" WIDTH=\"25\" HEIGHT=\"24\" BORDER=\"0\" ALIGN=\"absmiddle\"> <B>تم رفع الملف بنجاح.</B></font>";
$file_url = $vboptions['bburl']."/".$absolute_path.$file_name;
$endresult .="<br><a href=\"$file_url\">$file_url</a>";
$closewindow = 'window.returnValue =\''.$file_url.'\';';
}else{
$closewindow = 'window.returnValue = \'\';';
}
echo "
<HTML id=dlgImage dir=\"rtl\">
<head>
<title>رفع الصور- $vboptions[bbtitle]</title>
<style>
html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
</style>
</head>
<body style=\"background: threedface; color: windowtext;\" scroll=no>
<center> $endresult </center><br>
<center><BUTTON onClick=\"$closewindow window.close();\">عوده</BUTTON></center><br>
</body>
</html>";
}
break;
وأسئل الله ان يجزيك خير ماعملت