Welcome Guest, Not a member yet? Register   Sign In
mime_in throws error when file is not passed
#1

I have this code:

PHP Code:
  $validationRules = [
            'name'          => 'required',
            'subject'       => 'required',
            'email'         => 'required',
            'message'       => 'required',
            'sede'          => 'required',
            'attachment'    => 'mime_in[attachment,application/pdf]|max_size[3024]'
        ];

        if (!$this->validate($validationRules)) {
            return $this->fail($this->validator->getErrors());
        

which is working fine when I pass the attachment field, but since that field is optional, when I doesn't send it I get:

The file attachment does not have an allowed mime type

How can I manage this?
Reply


Messages In This Thread
mime_in throws error when file is not passed - by sfarzoso - 05-27-2021, 08:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB