SHARE
TWEET

Untitled

a guest Jun 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(!is_null($data->image)){
  2.             if(is_null($request->file('image')) && $request->file('image')==''){
  3.                 $fileImage=$data->image;
  4.             }else{
  5.                 $rules=[
  6.                     'image' => 'mimes:jpeg,bmp,png,gif,jpg,pdf',
  7.                 ];
  8.                 $validator=Validator::make($request->all(),$rules);
  9.                 if($validator->fails()){
  10.                     return "<div class='alert alert-danger'>Terjadi kesalahan!Format tidak valid!</div>";
  11.                 }else{
  12.                     $fotoImage=$request->file('image');
  13.                     $destinationPath = 'public/uploads/DailySectionReport/'.$request->image_id;
  14.                     if (!file_exists($destinationPath)) {
  15.                         File::makeDirectory($destinationPath, $mode = 0777, true, true);
  16.                     }
  17.                     $fileImage = date('YmdHis') . '_' . $fotoImage->getClientOriginalName();
  18.                     $fotoImage->move($destinationPath, $fileImage);
  19.                 }
  20.  
  21.             }
  22.         }
  23.  
  24.         if(is_null($data->image)){
  25.             if(is_null($request->file('image')) && $request->file('image')==''){
  26.                 $fileImage=$data->image;
  27.             }else{
  28.                 $rules=[
  29.                     'image' => 'mimes:jpeg,bmp,png,gif,jpg,pdf',
  30.                 ];
  31.                 $validator=Validator::make($request->all(),$rules);
  32.                 if($validator->fails()){
  33.                     return "<div class='alert alert-danger'>Terjadi kesalahan!Format tidak valid!</div>";
  34.                 }else{
  35.                     $fotoImage=$request->file('image');
  36.                     $destinationPath = 'public/uploads/DailySectionReport/'.$request->image_id;
  37.                     if (!file_exists($destinationPath)) {
  38.                         File::makeDirectory($destinationPath, $mode = 0777, true, true);
  39.                     }
  40.                     $fileImage = date('YmdHis') . '_' . $fotoImage->getClientOriginalName();
  41.                     $fotoImage->move($destinationPath, $fileImage);
  42.                 }
  43.  
  44.             }
  45.         }
  46.  
  47.         $data->image = $fileImage;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top