?
Path : /home/admin/domains/happytokorea.com/public_html/backend/modules/goods/ |
Current File : /home/admin/domains/happytokorea.com/public_html/backend/modules/goods/upload_pdf.php |
<? session_start(); require_once('../../../config.php'); require_once('../../../libs/MySql.php'); require_once('../../../libs/function.php'); require_once('../../../libs/global.php'); require_once('../../../libs/backoff_ajax.php'); require_once('../../../libs/backoff.php'); require_once('../../modules/users/mod_user.php'); $db=new MySql; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><HEAD> <TITLE><? echo $cfg['site_name'];?></TITLE> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <META content="" name=Keywords> <META content="<?echo $cfg['site_name'];?>" name="Description"> <META content="<?echo $cfg['site_name'];?>" name="Author"> </head> <?php //Upload รูป if(!$_POST) { ?> <body> PDF ขนาดไม่เกิน 10 mb <div style="padding:10px;"> <form method="post" action="<? echo $_SERVER['PHP_SELF']?>" enctype="multipart/form-data"> <INPUT type="file" name="photo"> <input name="tour_id" type="hidden" id="tour_id" value="<?=$_GET['tour_id']?>" /> <br> <br> <BUTTON ID=btnOK name="send" value="send" type=submit tabIndex=40>บันทึก</BUTTON> <BUTTON ID=btnCancel type=reset tabIndex=45 onClick="window.close();">ยกเลิก</BUTTON> </form> </div> <? } else { $filename=$_FILES['photo']['name']; $filetype=$_FILES['photo']['type']; $filetmp=$_FILES['photo']['tmp_name']; $pic="tour-00{$_POST[tour_id]}".Random_Int(4).date('dmYHism',time()); if ( $filetype == "application/pdf" ){ $filename1=$pic.".pdf"; } else{ echo"<script language=\"javascript\"> alert('ไม่ใช่ไฟล์ที่กำหนด...'); window.close(); </script>"; exit(); } if($_FILES['photo']['size']>10240000){ echo"<script language=\"javascript\"> alert('ไฟล์ใหญ่กว่ากำหนด...{$_FILES['photo']['size']}'); window.close(); </script>"; exit(); } if($filename!=""){ $data=Array( 'pdf'=>$filename1, ); $db->Update('tour',$data,"WHERE id='{$_POST[tour_id]}'"); move_uploaded_file($filetmp,"../../../tour/pdf/$filename1"); } echo"<script language=\"javascript\"> alert('บันทึกเรียบร้อย...'); window.close(); </script>"; }//ปิด send ?> </body></html>