Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public function add_filling_detail(Request $request)
  2.  
  3. {
  4.  
  5. $this->validate($request, [
  6.  
  7. 'image_path' => 'required|mimes:doc,docx,pdf,jpeg,jpg,png|max:2048'
  8.  
  9. ]);
  10.  
  11. $image_path = $request->file('image_path');
  12.  
  13. $new_name = rand() . '.' . $image_path->getClientOriginalExtension();
  14.  
  15. Oil_Filling::create([
  16.  
  17.  
  18. 'image_path' => $image_path->move('filling_images', $new_name),
  19.  
  20. ]);
  21.  
  22. return redirect('admin/filing_list');
  23.  
  24. }
  25.  
  26. <form method="post" action="{{ url('oil_filling/add_filling_detail') }}" enctype="multipart/form-data">
  27.  
  28. <div class="form-group">
  29. <label class="control-label">image Upload</label>
  30. <input type="file" name="image_path" class="form-control" required>
  31. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement