ถามกับการใ้คำสัง chmod 777 ครับ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ถามกับการใ้คำสัง chmod 777 ครับ

ถามกับการใ้คำสัง chmod 777 ครับ
ผมทำการอัพโหลด รูปภาพ แล้ว ผม ลบผ่านเว็บไม่ได้นะครับ ตอนนี้ผมเอาขึ้นโฮส จริงแล้วครับ
ผมได้ไปแก้ที่  FTP  ให้ โฟลเดอร์ที่เก็บรูป  เป็น  777 แล้ว แต่ว่า พออัพโหลดรูปไปแล้ว รูปที่อัพ มันเป็น  สิทธิ 644 เจ้าของ/กลุ่ม 33 33   ครับ 
แต่ถ้าผมโยนไฟล์ผ่าน FTP เลย จะเป็น สิทธิ 644 เจ้าของ/กลุ่ม 4724 4724 

ผมจะใช้คำสัง  chmod ใช้ไม่ถูกนะครับ ลองหลายวิธีแล้วไม่ได้ ผมจะตั้ง pemissions  เป็น 777 ยังไงครับ

 

โค้ด อัพ ไฟล์ ครับ

function upimg($img,$imglocate){
        if($img['name']!=''){
            $fileupload1=$img['tmp_name'];
            $g_img=explode(".",$img['name']);
            $file_up=time().".".$g_img[1];
            if($fileupload1){
                $array_last=explode(".",$file_up);
                $c=count($array_last)-1;
                $lastname=strtolower($array_last[$c]);
                @copy($fileupload1,$imglocate.$file_up);            
               
            }                
        }
        return $file_up;
    }

    
        if($_FILES['pic']['name']!=""){
            $my_filename=upimg($_FILES['pic'],"../images/picatt/");
           
        }
    
    
    $sql_insert="INSERT INTO `database`.`attractions` ( pic ) VALUES ('".$my_filename."')";


โค้ด ลบรูป 

if($pic != ""){
                   
                    @unlink("../images/picatt/".$pic);#ลบภาพเดิมออก
                }


Lonelyman 110.169.138.xxx 07-12-2013 13:15:41

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
<?php
function uppic_only($img,$imglocate){ // แบบใช้ชื่อไฟล์เดิม
	$allowed_types=array('jpg','jpeg','gif','png','swf');   
	if($img['name']!=''){
		$fileupload1=$img['tmp_name'];
		$g_img=explode(".",$img['name']);
		$ext = strtolower(array_pop($g_img));  
		$file_up=strtolower($img['name']); 
		if($fileupload1!="" && in_array($ext,$allowed_types)){
				@copy($fileupload1,$imglocate.$file_up);	
				@chmod($imglocate.$file_up,0777);				
		}				
	}
	return $file_up; // ส่งกลับชื่อไฟล์
}
function uppic_only_new($img,$imglocate,$new_name){ // แบบมีกำหนดชื่อใหม่
	$allowed_types=array('jpg','jpeg','gif','png','swf');   
	if($img['name']!=''){
		$fileupload1=$img['tmp_name'];
		$g_img=explode(".",$img['name']);
		$ext = strtolower(array_pop($g_img));  
		$file_up=$new_name.".".$ext;
		if($fileupload1!="" && in_array($ext,$allowed_types)){
				@copy($fileupload1,$imglocate.$file_up);	
				@chmod($imglocate.$file_up,0777);				
		}				
	}
	return $file_up; // ส่งกลับชื่อไฟล์
}
?>




หรือเพิ่มโค้ตนี้  

@chmod($imglocate.$file_up,0777);


ต่อเข้าไปจากบรรทัด  

@copy($fileupload1,$imglocate.$file_up);  


ninenik 115.67.226.xxx 08-12-2013






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ