Skip to content

Commit 285ace3

Browse files
authored
Merge pull request #149 from bakaphp/fix-upload-files
2 parents 9e13573 + b606981 commit 285ace3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Validations/File.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Baka\Validations;
66

77
use Baka\Validation as CanvasValidation;
8+
use Phalcon\Di;
89
use Phalcon\Http\Request\FileInterface;
910
use Phalcon\Validation\Validator\File as FileValidator;
1011

@@ -56,9 +57,9 @@ public static function validate(FileInterface $file) : bool
5657
'file',
5758
new FileValidator($uploadConfig)
5859
);
59-
60+
$req = Di::getDefault()->get('request');
6061
//phalcon has a issue it requires to be a POST to validate file, so we ignore this for now
61-
if (php_sapi_name() != 'cli') {
62+
if ($req->hasFiles()) {
6263
//validate this form for password
6364
$validator->validate([
6465
'file' => [

0 commit comments

Comments
 (0)