الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ساعدونى فى تصحيح ملف رفع الصور

مغلق
بدأه احمد زين في 21 يونيو 2007 · 0 رد · 400 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1

icon14.gifساعدونى فى تصحيح ملف رفع الصور بسم الله

ارجو من السادة الافاضل اعضاء المنتدى

مساعدتى فى الوصول الى خطا فى ملف رفع الصور

حيث اننى عند القيام برفع الصور لا يظهر لى شى

الملف

<? include("config.php");?>
<html  dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>Untitled Document</title>
</head>
<body>
<?
 function save_small_img($saveToDir, $imagePath, $imageName, $max_x, $max_y) {
  preg_match("'^(.*)\.(gif|jpe?g|png|swf)$'i", $imageName, $ext);

   switch (strtolower($ext[2])) {
	case 'jpg' : 
	case 'bmp':
	case 'jpeg': $im   = imagecreatefromjpeg ($imagePath);
	break;
	case 'gif' : 
	//$im   = imagecreatefromgif  ($imagePath);
	 $paths="{$saveToDir}{$ext[1]}.".strtolower($ext[2]);
	 move_uploaded_file($imagePath, $paths);
	 $stop[0]=$paths;
	 $stop[1] = true;

	break;
	case 'png' : $im   = imagecreatefrompng  ($imagePath);
	break;
	case 'swf' : 
	 $paths="{$saveToDir}{$ext[1]}.".strtolower($ext[2]);
	 move_uploaded_file($imagePath, $paths);
	 $stop[0]=$paths;
	 $stop[1] = true;
	break;
	default	: 
	$stop[1] = false;
	break;
   }

 }

 ?>
<? if($_POST['do']==""){?>
 <form method="post" action="?">
 <input type="hidden" name="do" value="insert" />

 <table  width="82%" bgcolor="#f3f3f3">
  <tr>
  <td><font class="smart3"> محتويات التصنيف</font></font></td>
  </tr>
  <tr>
  <td height="183">
   <table   width="100%" bgcolor="#CCCCCC" >
	<tr >
	 <td align="center">الاسم: </td>
	 <td><input type="text" name="name" value="" /></td>
	</tr>
	<tr>
	 <td align="center">الوصف:</td>
	 <td><textarea name="info" rows="6" cols="20"></textarea></td>
	 </tr>
	<tr>
	 <td align="center">الصورة:</td>
	 <td><input type="file" name="pic" value="" /></td>
	</tr>
   </table>
	</td>
  </tr>
   <tr>
   <td align="center" ><input type="submit" name="send" value="حفظ" />  
   <input type="reset" name="ce" value="مسح" />
   </td>
  </tr>

 </table>
 </form>
<? } ?> 
<?
if($_POST['do']=="insert"){$name=$_POST[name];
$info=$_POST[info];
$pic_name=$_POST[pic_name];
  if($_FILES["pic"]["tmp_name"]!="")
  {  $i=time(); 
	$exe1=explode(".",$_FILES['pic']['name']);
	$newfile2=$i.".".$exe1[count($exe1)-1];
	$type1=array("JPG","GIF","BMP","JPEG");
	if(in_array(strtoupper($exe1[count($exe1)-1]),$type1)){
	 $X1=copy($_FILES['pic']['tmp_name'],"upload_files/$newfile2") or die('error electronic loead');
   //---------------------------تصغير صوره-----------------------
	$saveToDir="upload_files/";
	$imagePath=$_FILES['pic']['tmp_name'];
	$imageName="src".time().".".$exe1[count($exe1)-1];
	  $max_x=150; 
	$max_y=200; 
	$test=save_small_img($saveToDir, $imagePath, $imageName, $max_x, $max_y);

	$sql="INSERT INTO `cat`(`name`,`info`,`pic_name`,`smallfile`,`add_date`)VALUES('$name','$info','$newfile2','$imageName',NOW())";
	   echo $sql;
	$query=mysql_query($sql)or die(mysql_error());
	echo "<script>alert('تمت لإضافة بنجاح');</script>";
	echo"<script>location.href('addcat.php')</script>";	 }else{
	$X1=false;
	?>
	<script language="javascript">
	alert("هذا النوع من الملفات ممنوع استخدامه");
	</script>
	<? }
   }

}
?></body>
</html>

هذا الموضوع مغلق.

مواضيع مشابهة