Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

How to return false? #104

Closed
kilinanatoly opened this issue May 3, 2017 · 1 comment
Closed

How to return false? #104

kilinanatoly opened this issue May 3, 2017 · 1 comment
Labels

Comments

@kilinanatoly
Copy link

I am from Russia and I write through an interpreter.
I need to return false under certain conditions and output an error for the user. how to do it? I try this way:
Return Json :: encode (['files' => [], 'error' => 'The file exceeds the permissible size in XXX MB']);

But still in the console I see that the 'fileuploaddone' method works. Go out mistake.Empty file upload result. Please help me!

@tonydspaniard
Copy link
Member

Return false? Or return error? You need to add a rule to your Model and then validate: https://github.com/2amigos/yii2-file-upload-widget/blob/master/src/actions/FileUploadAction.php#L114

That will fire an error, and the plugin will display the error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants