1111
1212use Nette ;
1313use Nette \Forms ;
14+ use Nette \Forms \Form ;
1415use Nette \Http \FileUpload ;
1516
1617
@@ -34,7 +35,7 @@ public function __construct($label = null, bool $multiple = false)
3435 $ this ->setOption ('type ' , 'file ' );
3536 $ this ->addRule ([$ this , 'isOk ' ], Forms \Validator::$ messages [self ::VALID ]);
3637
37- $ this ->monitor (Forms \ Form::class, function (Forms \ Form $ form ): void {
38+ $ this ->monitor (Form::class, function (Form $ form ): void {
3839 if (!$ form ->isMethod ('post ' )) {
3940 throw new Nette \InvalidStateException ('File upload requires method POST. ' );
4041 }
@@ -48,7 +49,7 @@ public function __construct($label = null, bool $multiple = false)
4849 */
4950 public function loadHttpData (): void
5051 {
51- $ this ->value = $ this ->getHttpData (Nette \ Forms \ Form::DATA_FILE );
52+ $ this ->value = $ this ->getHttpData (Form::DATA_FILE );
5253 if ($ this ->value === null ) {
5354 $ this ->value = new FileUpload (null );
5455 }
@@ -103,9 +104,9 @@ public function isOk(): bool
103104 */
104105 public function addRule ($ validator , $ errorMessage = null , $ arg = null )
105106 {
106- if ($ validator === Forms \ Form::IMAGE ) {
107+ if ($ validator === Form::IMAGE ) {
107108 $ this ->control ->accept = implode (', ' , FileUpload::IMAGE_MIME_TYPES );
108- } elseif ($ validator === Forms \ Form::MIME_TYPE ) {
109+ } elseif ($ validator === Form::MIME_TYPE ) {
109110 $ this ->control ->accept = implode (', ' , (array ) $ arg );
110111 }
111112 return parent ::addRule ($ validator , $ errorMessage , $ arg );
0 commit comments