PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : تعمير قسمت آپلود مامبو



hadinahavandi
03-17-2008, 08:54 PM
سلام
قسمت آپلود در مامبو 4.6.1 مشكل در نمايش پيام داشت
براي درست كردنش ميتونيد كد زير رو توي فايل administrator\popups\uploadimage.php كپي كنيد(كدهاي قبلي توي اون رو هم پاك كنيد)
<?php


//$adminside = 3;
//require_once('../../index.php');
$directory = mosGetParam( $_REQUEST, 'directory', '');

$userfile2=(isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : "");
$userfile_name=(isset($_FILES['userfile']['name']) ? $_FILES['userfile']['name'] : "");

if (isset($_FILES['userfile'])) {
if ($directory!="banners") {
$base_Dir = "../images/stories/";
} else {
$base_Dir = "../images/banners/";
}
if (empty($userfile_name)) {
echo "<script>alert('Please select an image to upload'); window.history.go(-1);</script>";
}

$filename = split("\.", $userfile_name);

if (eregi("[^0-9a-zA-Z_]", $filename[0])) {
echo "<script> alert('File must only contain alphanumeric characters and no spaces please.'); window.history.go(-1);</script>\n";
exit();
}

if (file_exists($base_Dir.$userfile_name)) {
echo "<script> alert('".sprintf('Image %s already exists.',$userfile_name) ."'); window.history.go(-1);</script>\n";
exit();
}

if ((strcasecmp(substr($userfile_name,-4),".gif")) && (strcasecmp(substr($userfile_name,-4),".jpg")) && (strcasecmp(substr($userfile_name,-4),".png")) && (strcasecmp(substr($userfile_name,-4),".bmp")) &&(strcasecmp(substr($userfile_name,-4),".doc")) && (strcasecmp(substr($userfile_name,-4),".xls")) && (strcasecmp(substr($userfile_name,-4),".ppt")) && (strcasecmp(substr($userfile_name,-4),".swf")) && (strcasecmp(substr($userfile_name,-4),".pdf"))) {
echo "<script>alert('The file must be gif, png, jpg, bmp, swf, doc, xls or ppt'); window.history.go(-1);</script>\n";
exit();
}


if (eregi(".pdf", $userfile_name) || eregi(".doc", $userfile_name) || eregi(".xls", $userfile_name) || eregi(".ppt", $userfile_name)) {
if (!move_uploaded_file ($_FILES['userfile']['tmp_name'],$media_path.$_FILES['userfile']['name']) || !mosChmod($media_path.$_FILES['userfile']['name'])) {
echo "<script>alert('".sprintf('Upload of %s failed', $userfile_name) ."'); window.history.go(-1);</script>\n";
exit();
}
else {
echo "<script>alert('".sprintf('Upload of %s to %s successful', $userfile_name, $media_path) ."'); window.history.go(-1);</script>\n";
exit();
}
} elseif (!move_uploaded_file ($_FILES['userfile']['tmp_name'],$base_Dir.$_FILES['userfile']['name']) || !mosChmod($base_Dir.$_FILES['userfile']['name'])) {
echo "<script>alert('".sprintf('Upload of %s failed', $userfile_name) ."'); window.history.go(-1);</script>\n";
exit();
}
else {
echo "<script>alert('".sprintf('Upload of %s to %s successful', $userfile_name, $base_Dir) ."'); window.history.go(-1);</script>\n";
exit();
}


}

$iso = split( '=', _ISO );
// xml prolog

echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
?>
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
&lt;html xmlns=&quot;<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
&lt;head&gt;
&lt;title&gt;&#38;#1570;&#38;#1662;&#38;#1604;&#38;#1608;&#38;#1583; &#38;#1601;&#38;#1575;&#38;#1610;&#38;#1604;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
$css = mosGetParam($_REQUEST,&quot;t&quot;,&quot;&quot;);
?&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;../administrator/templates/&lt;?php echo $css; ?&gt;/css/template_css.css&quot; type=&quot;text/css&quot; /&gt;
&lt;table class=&quot;adminform&quot;&gt;
&lt;form method=&quot;post&quot; action=&quot;index3.php?pop=uploadimage.php&quot; enctype=&quot;multipart/form-data&quot; name=&quot;filename&quot;&gt;
&lt;tr&gt;
&lt;th class=&quot;title&quot;&gt;&#38;#1570;&#38;#1662;&#38;#1604;&#38;#1608;&#38;#1583; &#38;#1601;&#38;#1575;&#38;#1610;&#38;#1604;: &lt;?php echo $directory; ?&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;
&lt;input class=&quot;inputbox&quot; name=&quot;userfile&quot; type=&quot;file&quot; /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;input class=&quot;button&quot; type=&quot;submit&quot; value=&quot;Upload&quot; name=&quot;fileupload&quot; /&gt;
&#38;#1581;&#38;#1583;&#38;#1575;&#38;#1603;&#38;#1579;&#38;#1585; &#38;#1575;&#38;#1606;&#38;#1583;&#38;#1586;&#38;#1607; &#38;#1601;&#38;#1575;&#38;#1610;&#38;#1604; = &lt;?php echo ini_get( &#039;post_max_size&#039; );?&gt;
&lt;/td&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;div align=&quot;right&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;directory&quot; value=&quot;&lt;?php echo $directory;?&gt;&quot; /&gt;
&#38;#1608;&#38;#1610;&#38;#1585;&#38;#1575;&#38;#1610;&#38;#1588; &#38;#1578;&#38;#1608;&#38;#1587;&#38;#1591; &#38;#1607;&#38;#1575;&#38;#1583;&#38;#1610; &#38;#1575;&#38;#1605;&#38;#1610;&#38;#1585;&#38;#1606;&#38;#1607;&#38;#1575;&#38; #1608;&#38;#1606;&#38;#1583;&#38;#1610; &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/form&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;