<?php foreach($_POST['config'] as $gvalue) { //เช็คว่ามี ข้อมูล meta หรือยัง $check_meta = mysql_query("select * from config where config_meta='".$gvalue['config_meta']."' "); if(!mysql_num_rows($check_meta)){ // ถ้าไม่มีให้เพิ่มเข้าไป $insert = "insert into config(config_meta) value('".$gvalue['config_meta']."')"; mysql_query($insert); } //เช็คว่าเป็นข้อมูลไฟล์ ยังไง?? // จากนั้น นำข้อมูล value ไปป้อนใน meta $update_data = "update config set config_value='".$gvalue['config_value']."' where config_meta='".$gvalue['config_meta']."'"; mysql_query($update_data); } ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="xxxx" id="xxxx"> <input type="submit" name="button" id="button" value="Submit"> <? if ($_FILES['xxxx'][type]=="image/jpeg") { echo "นี่คือรูปภาพนะ"; } else { echo "นี่ไม่ไช่รูปภาพคืออะไรก็ไม่รู้"; } ?> </form>
if($_FILES['txtconfig_logo']['name']){ $config_logo = $_FILES['txtconfig_logo']['name']; //image name $tmp_name = $_FILES['txtconfig_logo']['tmp_name']; //Temp Polily $fmrandom = time(); $blogo0 = explode(".",$config_logo); $blogo1=count($blogo0)-1; // split choose file name $blogoextension=strtolower($blogo0[$blogo1]); // make extension file $blogo_file_name ="blogo". $fmrandom.".".$blogoextension; // full filename $blogouploadfile = $uploadDir.basename($blogo_file_name); if($blogoextension !="jpg" && $blogoextension !="gif" && $blogoextension !="png"){ //Only accept jpg,gif,png //Error Message Box Not file accepted $text="Your extension file is: $blogoextension ,We accept file extension .jpg, .gif and .png only."; msgbox($text,$movetourl); } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง