|
 |
|
[ *help ] ----------- $_FILES['xxx']['type'] นี่ถ้าใช้ FF กะ IE ค่าที่ได้มันต่างกันยังงัยครับ |
|
 |
|
|
 |
 |
|
รุปนามสกุล jpg
ถ้าบะหมี่ FF จะได้ 'image/jpeg'
แต่ถ้า IE จอมติ๊งต๊อง จะได้ 'image/pjpeg';
|
 |
 |
 |
 |
Date :
2009-10-02 12:16:41 |
By :
danya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อ กระจ่างล่ะ ทีแท้ เป็นแบบนี้นี้เอง
โอเคล่ะ ใช้งานได้เรียบร้อยต้องเพิ่มการตรวจสอบเป็น 'image/jpeg' เพราะมันเก่ามันมีแต่ 'image/jpg'
|
 |
 |
 |
 |
Date :
2009-10-02 12:32:07 |
By :
somparn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ คุณ ดุนยา 
คุณ phpbasic แก้ปัญหาได้แล้วหรือยังครับ
|
 |
 |
 |
 |
Date :
2009-10-02 19:46:21 |
By :
pokultra |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อได้แล้วครับ ตอนนี้ใช้งานได้ล่ะครับ
แต่ว่าถ้าใช้ของ java ตรวจสอบ นั้นยังไม่ได้เลยแหะยัง งง อยู่เหมือนกันนี้คือโค้ด java ที่ยัง งงอยู่ว่าทำไมเป็ฯไฟล์ jpg gif ต่างๆที่ตามกำหนดมันยัง alert บอกว่าต้องเป็ฯไฟล์นี้ๆเท่านั้น
Code (PHP)
<script language="javascript">
function chk(){
var a=document.form1.image.value;
fty=new Array(".gif",".jpg",".jpeg",".png");
for(i=0;i<fty.length;i++){
if(a !="" && a.lastIndexOf(fty[i])==-1){
alert("อัพโหลดได้เฉพาะไฟล์ gif jpg jpeg png");
return false;
}
}
}
</script>
Code (PHP)
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return chk();">
<input name="image" id="image" type="file">
<input name="Submit" id="Submit" value="Upload" type="submit">
</form>
ลองแบบ java แล้วเพี๊ยนแหะ เป็นทั้ง ie และ firefox เลย 5555
ลองดูให้หน่อยนะครับ วันนี้เน็ตที่บ้านไม่ค่อยดีเท่าไรหลุดๆหายก็เลยไม่ได้เข้ามาดูเลย (ไปกินยอดข้าวดีกว่า)
|
 |
 |
 |
 |
Date :
2009-10-02 23:05:26 |
By :
somparn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|