Viewing file: upload.php (1.52 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ob_start(); session_start();
if(isset($_POST['submitform'])){
$datenow=date("Y-m-d"); $title=$_POST['input_title']; $short=$_POST['input_short']; $detail=$_POST['input_detail']; $title=$_POST['input_title'];
if (!empty($_FILES["inputfile"]["name"])){ $images = $_FILES["inputfile"]["tmp_name"]; $file = strtolower($_FILES["inputfile"]["name"]); //$sizefile = $_FILES["inputfile"]["size"]; $datefile=date("YmdHis"); $type= strrchr($file,"."); $newname = "thumbnails_".mt_rand(10,9999).$datefile; //copy($_FILES["inputfile"]["tmp_name"],"uploads/".$_FILES["inputfile"]["name"]); $width=800; //*** Fix Width & Heigh (Autu caculate) ***// $size=GetimageSize($images); $height=round($width*$size[1]/$size[0]); $images_orig = ImageCreateFromJPEG($images); $photoX = ImagesX($images_orig); $photoY = ImagesY($images_orig); $images_fin = ImageCreateTrueColor($width, $height); ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY); ImageJPEG($images_fin,"uploads/".$newname.$type); ImageDestroy($images_orig); ImageDestroy($images_fin); }else{ echo "no file"; }
$strSQL = $conn->prepare("INSERT INTO tbl_product (article_id,titlename,image_v,imgtype,detail,creat_date,shortsummary) VALUES ('A01','$title', '$newname','$type','$detail','$datenow','$short')"); $strSQL->execute();
}else{
}
?>
|