@@ -323,9 +323,10 @@ public static function validateFloat(IControl $control): bool
323323	/** 
324324	 * Is file size in limit? 
325325	 */ 
326- 	public  static  function  validateFileSize (Controls \ UploadControl   $ control , $ limit ): bool 
326+ 	public  static  function  validateFileSize (IControl   $ control , $ limit ): bool 
327327	{
328328		foreach  (static ::toArray ($ control ->getValue ()) as  $ file ) {
329+ 			Validators::assert ($ file , Nette \Http \FileUpload::class, 'control value ' );
329330			if  ($ file ->getSize () > $ limit  || $ file ->getError () === UPLOAD_ERR_INI_SIZE ) {
330331				return  false ;
331332			}
@@ -338,10 +339,11 @@ public static function validateFileSize(Controls\UploadControl $control, $limit)
338339	 * Has file specified mime type? 
339340	 * @param  string|string[]  $mimeType 
340341	 */ 
341- 	public  static  function  validateMimeType (Controls \ UploadControl   $ control , $ mimeType ): bool 
342+ 	public  static  function  validateMimeType (IControl   $ control , $ mimeType ): bool 
342343	{
343344		$ mimeTypes  = is_array ($ mimeType ) ? $ mimeType  : explode (', ' , $ mimeType );
344345		foreach  (static ::toArray ($ control ->getValue ()) as  $ file ) {
346+ 			Validators::assert ($ file , Nette \Http \FileUpload::class, 'control value ' );
345347			$ type  = strtolower ($ file ->getContentType ());
346348			if  (!in_array ($ type , $ mimeTypes , true ) && !in_array (preg_replace ('#/.*# ' , '/* ' , $ type ), $ mimeTypes , true )) {
347349				return  false ;
@@ -354,9 +356,10 @@ public static function validateMimeType(Controls\UploadControl $control, $mimeTy
354356	/** 
355357	 * Is file image? 
356358	 */ 
357- 	public  static  function  validateImage (Controls \ UploadControl   $ control ): bool 
359+ 	public  static  function  validateImage (IControl   $ control ): bool 
358360	{
359361		foreach  (static ::toArray ($ control ->getValue ()) as  $ file ) {
362+ 			Validators::assert ($ file , Nette \Http \FileUpload::class, 'control value ' );
360363			if  (!$ file ->isImage ()) {
361364				return  false ;
362365			}
0 commit comments