Warning: trim() expects parameter 1 to be string (Unicode or binary), array given in C:\AppServ\www\Project\admin\banner_record.php on line 23
Strict Standards: Only variables should be passed by reference in C:\AppServ\www\Project\admin\banner_record.php on line 29
Insert Into db_banner (banner_id , company_name, type , web_url) Values('3' ,'AA', '1' , 'aa' )
Code (PHP)
if(trim($_FILES['fileupload2'])!== ""){
$fileupload2=$_FILES['fileupload2']['tmp_name'];
$fileupload_name2= $_FILES['fileupload2']['name'];
$fileupload_size2= $_FILES['fileupload2']['size'];
$fileupload_type2= $_FILES['fileupload2']['type'];
$type2=$_POST[type];
$ext2=strtolower(end($a=explode('.', $fileupload_name2)));
if ($ext2==""){
} else {
if ($ext2=="jpg" or $ext2=="jpeg" ) {
$ori_img2= imagecreatefromjpeg($fileupload2);
}else if ($ext2=="png"){
$ori_img2= imagecreatefrompng($fileupload2);
}else if ($ext2=="gif") {
$ori_img2= imagecreatefromgif($fileupload2);
}
$ori_size2=getimagesize($fileupload2);
$ori_w2= $ori_size2[0];
$ori_h2= $ori_size2[1];
if($ori_w2>=$ori_h2) {
$new_w2=100;
$new_h2=round(($new_w2/$ori_w2)* $ori_h2);
}else{
$new_h2=75;
$new_w2=round(($new_h2/$ori_h2)* $ori_w2);
}
$new_img2= imagecreatetruecolor($new_w2, $new_h2);
imagecopyresized ($new_img2, $ori_img2,0,0,0,0,$new_w2,$new_h2,$ori_w2,$ori_h2);
$PicName2 = "logo".$ID.".".$ext2;
if ($ext2=="jpg" or $ext2=="jpeg" ) {
imagejpeg($new_img2, "../img_banner/$PicName2");
}else if ($ext2=="png") {
imagepng($new_img2," ../img_banner/$PicName2");
}else if ($ext2=="gif") {
copy($fileupload2,"../img_banner/$PicName2");
}
imagedestroy($ori_img2);
imagedestroy($new_img2);
$Sq = "Update db_banner Set banner ='".$PicName2."' Where banner_id = '".$ID."'";
mysql_query($Sq);
}