0

I want to validate image name in laravel. How can I get the value of input image name and pass it to rules() method in custom created UploadRequest. I want to validate if image name is maximum 20 characters and only alpha numeric.

uploadRequest file: uploadRequest file

upload form view: upload form view

Hakan ERDOGAN
  • 1,150
  • 8
  • 19
Denis2310
  • 939
  • 1
  • 15
  • 41

1 Answers1

0

Someone already ask the question you should tcheck it. And for the information a custom validation is recommended.

Question already answered

Castro Alhdo
  • 293
  • 3
  • 8
  • Thanks for the answer but I dont want to validate if image name is unique, just if it is longer than 20 characters. I want to validate name length in rules() method. – Denis2310 Jun 04 '18 at 13:31
  • I point you to this answer because they used the regex to solve the problm – Castro Alhdo Jun 04 '18 at 13:35
  • I have found easy solution. If statement in controller method that checks length of file name in request resolves the problem. – Denis2310 Jul 19 '18 at 18:39