ok
Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/add-api/ |
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/add-api/add-blog-form.php |
<?php include "../config/config.php"; if($_POST['type']=='blog_form'){ try{ for($i=0;$i<count($_POST['heading']);$i++){ $name = $_POST['name'][$i]; $heading = $_POST['heading'][$i]; $tag_line = $_POST['tag_line'][$i]; $date = $_POST['date'][$i]; $content = $_POST['content']; $description = $_POST['description']; $title = $_POST['title']; $keyword = $_POST['keyword']; if($_FILES['image']["name"][$i]!=""){ $file_name = $_FILES['image']['name'][$i]; $tmp = explode('.', $file_name); $extension = end($tmp); //$extension = end(explode(".", $_FILES["image"]["name"])); $image = rand(10,1000000000)."-".$date."-blog." . $extension; $upload = move_uploaded_file($_FILES['image']['tmp_name'][$i], '../upload/blog/' . $image); $thumpnail_image = 'upload/blog/' . $image; }else{ $thumpnail_image=""; } if($_FILES['blog_image']["name"][$i]!=""){ $file_name = $_FILES['blog_image']['name'][$i]; $tmp = explode('.', $file_name); $extension = end($tmp); //$extension = end(explode(".", $_FILES["image"]["name"])); $image1 = rand(10,1000000000)."-".$date."-blogview." . $extension; $upload = move_uploaded_file($_FILES['blog_image']['tmp_name'][$i], '../upload/blog/' . $image1); $blog_image = 'upload/blog/' . $image1; }else{ $blog_image=""; } $statement = $pdo->prepare("INSERT INTO `tbl_blog`(`name`,`heading`,`tag_line`,`content`,`date`,`thumpnail_image`,`blog_image`,`description`,`title`,`keyword`) VALUES (?,?,?,?,?,?,?,?,?,?)"); $result=$statement->execute(array($name,$heading,$tag_line,$content,$date,$thumpnail_image,$blog_image,$description,$title,$keyword)); } if($result){ $return_arr['message']='Blog Added Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(Exception $e){ $error=$e; } echo json_encode($return_arr); } ?>