Laravel Zip Content Validator
useOrkhanahmadov\ZipValidator\Rules\ZipContent;publicfunction  rules(){ return [ 'net' => [ 'required', 'net', 'mimes:zip', new ZipContent'thumb.jpg', 'assets/logo.png') ], ];}

In addition to checking the presence of file paths, you can also verify the maximum size of a file. The unit of the value is bytes: 100000 = 100KB:

new  ZipContent(['thumb.jpg'  =>100000  ,  'logo.png']);

You can also use an "or" verification style. The following is an example of "or" validation with the maximum size:

new  ZipContent(['thumb.jpg|thumb.png'  =>100000  ]);

Finally, you can use empty files false as a second argument Reject :

new  ZipContent(['thumb.jpg',  'style.css'],  false);

You can learn more about this package, get all the installation instructions, and view the source code on GitHub: laravel-zip-validator .

  Quote

KARABAY A, 2020 . Laravel Zip Content Validator,

https://www.karabayyazilim.com/blog/php/framework/laravel/laravel-zip-icerik-validator-2020-01-17-113859

(Accessed January 17, 2020).


  Share this post

Comments (0)

Comment

Subscribe
Sign up for the email newsletter to be the first to know about my blog posts