Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. if($request->hasFile('photo')){
  2. request()->validate([
  3. 'photo' => 'image|mimes:jpeg,png,jpg,gif,svg,tiff,tif,raw,bmp,psd',
  4. ]);
  5.  
  6. $file = $request->file('photo');
  7. $name = $request->get('email')."-".$file->getClientOriginalName();
  8. // $file-> move($url,$name);
  9. $file->move(public_path().'/imageuser/', $name);
  10. }
  11.  
  12. <form action="{{ route('CatelFoto.store') }}" method="POST" enctype=”multipart/form-data”>
  13. {!! csrf_field() !!}
  14. <input type="hidden" id="id" name="id" value="{{ $id }}" readonly="readonly">
  15. <p><h2><b>Subir Foto</b></h2></p>
  16. <div class="form-group {{ $errors->has('photo') ? 'has-error' : '' }}">
  17. <label form="photo">Foto: </label>
  18. <input class="form-control-file" type="file" name="photo" id="photo" value="{{ old('photo') }}" required><br>
  19. </div>
  20. <button class="btn btn-primary">Siguiente</button>
  21. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement