-
تعمير قسمت آپلود مامبو
سلام
قسمت آپلود در مامبو 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(� 39;Upload of %s failed', $userfile_name) ."' window.history.go(-1);</script>\n";
exit();
}
else {
echo "<script>alert('".sprintf(� 39;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(� 39;Upload of %s failed', $userfile_name) ."' window.history.go(-1);</script>\n";
exit();
}
else {
echo "<script>alert('".sprintf(� 39;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] .'"?' .'>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
<html xmlns="[مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
<head>
<title>&#1570;&#1662;&#1604;& ;#1608;&#1583; &#1601;&#1575;&#1610;&#1604;< ;/title>
</head>
<body>
<?php
$css = mosGetParam($_REQUEST,"t",""
?>
<link rel="stylesheet" href="../administrator/templates/<?php echo $css; ?>/css/template_css.css" type="text/css" />
<table class="adminform">
<form method="post" action="index3.php?pop=uploadimage.php" enctype="multipart/form-data" name="filename">
<tr>
<th class="title">&#1570;&#1662;& #38;#1604;&#1608;&#1583; &#1601;&#1575;&#1610;&#1604;: <?php echo $directory; ?></th>
</tr>
<tr>
<td align="center">
<input class="inputbox" name="userfile" type="file" />
</td>
</tr>
<tr>
<td>
<input class="button" type="submit" value="Upload" name="fileupload" />
&#1581;&#1583;&#1575;&#1603;&# 1579;&#1585; &#1575;&#1606;&#1583;&#1586;&# 1607; &#1601;&#1575;&#1610;&#1604; = <?php echo ini_get( 'post_max_size' );?>
</td>
<tr>
<td>
<div align="right">
<input type="hidden" name="directory" value="<?php echo $directory;?>" />
&#1608;&#1610;&#1585;&#1575;&# 1610;&#1588; &#1578;&#1608;&#1587;&#1591; &#1607;&#1575;&#1583;&#1610; &#1575;&#1605;&#1610;&#1585;&# 1606;&#1607;&#1575;&#1608;&#1606;& #38;#1583;&#1610; </div></td>
</tr>
</form>
</table>
</body>
</html>
جهت مشاهده لینک ها باید ثبت نام کنید یا لاگین کنید.
-
-
03-17-2008 08:54 PM
# ADS
تبلیغات در جوملا فارسی
علاقه مندی ها (Bookmarks)