ทำให้แสดงรูปตัวอย่างก่อนไม่ได้

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

ทำให้แสดงรูปตัวอย่างก่อนไม่ได้

 จาก แสดงตัวอย่างรูป ก่อน upload - image preview berfore upload -

https://www.ninenik.com/content-arti_id-113.html

รองทำแล้วไม่ได้ครับ ทำไม เปลี่ยน action="aaaa.php" แล้วส่งไม่ไปครับ



Samyuranun 117.47.35.xxx 27-01-2009 05:31:11

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

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


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


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

 ความคิดเห็นที่ 1

ลองตั้งชื่อไฟล์ ตามตัวอย่างดูก่อน อย่าลืมว่าต้องสร้างโฟล์เดอร์ temp ด้วยน่ะครับ เทคนิดที่ใช้เป็นวิธีแบบง่ายๆ ถ้ามีวิธีที่ดีกว่าช่วยแนะนำด้วยน่ะครับ



ninenik 124.120.181.xxx 27-01-2009
 ความคิดเห็นที่ 2

ยังไม่ได้ครับ

index.php

 

<script language="javascript">
function show_pic(sc){
 document.form1.action='php_upload.php';
 document.form1.target='mypre';
 document.form1.submit(); 
}
</script>


<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="ddd">
     <input type="hidden" name="ac" id="ac" value="<?=$ac?>">
     <input type="hidden" name="IDPK" id="IDPK" value="<?=$rs_02_edit->fields['content_id']?>>">
     <input type="hidden" name="back" id="back" value="<?=$back?>">
     <input type="hidden" name="type" id="type" value="<?=$type?>">
     <input type="hidden" name="old_pic" id="old_pic" value="<?=$rs_02_edit->fields['pic']?>">
     <input type="hidden" name="old_file_01" id="old_file_01" value="<?=$rs_02_edit->fields['file_01']?>">
     <input type="hidden" name="old_file_02" id="old_file_02" value="<?=$rs_02_edit->fields['file_02']?>">
     <input type="hidden" name="back" id="back" value="<?=$back?>">
     <input type="hidden" name="poster" id="poster" value="<?=$_SESSION['admin_username_n']?>">

 

          <tr>
            <td width="77"><font size="2"  color="#0033FF">Picture :</font>  </td>
            <td width="600"><input type="file" name="pic" value="<?=$rs_02_edit->fields['title']?>" size="86" onchange="show_pic(this.value);"></td>
          </tr>
    
    
    <tr bgcolor='ffffff'>
     <td width="170">&nbsp;</td>
     <td width="600" class="FormBox" align='center'>
     <input type="submit" name="Submit" value="&nbsp;บันทึก&nbsp;">
     <input type="reset" name="No" value="&nbsp;ข้อมูลดั่งเดิม&nbsp;">
    <input type="button" name="Submit3" value="ยกเลิก"  onclick="history.back();">
    
     </td>
    </tr>

   </FORM>


<iframe name="mypre" width="0" height="1" frameborder="0"></iframe>
<span id="mypic1"></span>

 

 

php_upload.php

<?php  
function upimg($img,$imglocate){  
            global $file_up;  
            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]);  
                    if($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg" or $lastname=="swf"){                    
                        @copy($fileupload1,$imglocate.$file_up);              
                    }     
                }                 
            }  
}  
if($_FILES['pic']['name']!=""){  
    upimg($_FILES['pic'],"temp/");  
    echo "<script language="javascript">";  
    echo "var pl=top.document.getElementById('mypic1');";  
    echo "pl.innerHTML="<img src='temp/".$file_up."'  height='300' />";";  
    echo "top.document.form1.action='';";  
    echo "top.document.form1.target='';";  
    echo "</script>";  
    echo "<meta http-equiv="Refresh" content="0;URL=php_upload.php?d_img=".$file_up."" />";  
}  
?>  
<?php  
    if($_GET['d_img']!=""){  
        @unlink("temp/".$d_img);  
    }  
?> 



samyuranun 117.47.35.xxx 27-01-2009 22:24






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