<html> <head> <title>Read CSV & MSSQL </title> </head> <body> <br> <form action="phpCSVMySQLUpload.php" method="post" enctype="multipart/form-data" name="form1"> <input name="fileCSV" type="file" id="fileCSV"> <?php $objCSV = fopen("scan.csv", "r"); //scan.csv ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">Uid </div></th> <th width="98"> <div align="center">Qty </div></th> <th width="198"> <div align="center">Note </div></th> <th width="97"> <div align="center">Time/Date </div></th> </tr> <?php while (($objArr = fgetcsv($objCSV, 1000, ",")) !== FALSE) { ?> <tr> <td><div align="center"><?php echo $objArr[0];?></div></td> <td><?php echo $objArr[1];?></td> <td><?php echo $objArr[2];?></td> <td><div align="center"><?php echo $objArr[3];?></div></td> </tr> <?php } fclose($objCSV); ?>
<!doctype> <html> <head> <script src="jquery-2.1.1.min.js" ></script> <script type="text/javascript" src="base64/jquery.base64.js"></script> <script> function render_img( ob, img ){ var reader = new FileReader(); reader.onload = function (e) { $(img).attr('src', e.target.result); } reader.readAsDataURL($(ob)[0].files[0]); } function readSingleFile(evt) { //Retrieve the first (and only!) File from the FileList object var f = evt.target.files[0]; if (f) { var r = new FileReader(); r.onload = function(e) { var contents = e.target.result; $('#sample_txt').html( "<pre>Got the file.n" +"name: " + f.name + "\n" +"type: " + f.type + "\n" +"size: " + f.size + " bytes\n" + "=====================\n" + contents+"</pre>" ); } r.readAsText(f); } else { alert("Failed to load file"); } } $(document).ready(function(e){ $('#f').change(function(e){ if (typeof (FileReader) != "undefined") { var ext_img = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/; var ext_txt =/^([a-zA-Z0-9\s_\\.\-:])+(.txt|.sql|.csv)$/; if( ext_img.test($(this).val()) ) render_img('#f', '#sample_img'); // image else if( ext_txt.test($(this).val()) ) readSingleFile(e); // text } else alert("This browser does not support FileReader."); }); }); </script> </head> <body> <input type="file" id="f" /><br/> <img id="sample_img" / --> <div id="sample_txt" /> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง