ทำให้แสดงรูปตัวอย่างก่อนไม่ได้
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ทำให้แสดงรูปตัวอย่างก่อนไม่ได้
จาก แสดงตัวอย่างรูป ก่อน upload - image preview berfore upload -
https://www.ninenik.com/content-arti_id-113.html
รองทำแล้วไม่ได้ครับ ทำไม เปลี่ยน action="aaaa.php" แล้วส่งไม่ไปครับ

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

ยังไม่ได้ครับ
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"> </td>
<td width="600" class="FormBox" align='center'>
<input type="submit" name="Submit" value=" บันทึก ">
<input type="reset" name="No" value=" ข้อมูลดั่งเดิม ">
<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);
}
?>
