How do I upload file on click only?
I am trying to upload a file however I get this error and do not know what to do next.

7 Replies
Perhaps try to provide a type hint for your public property. Or set it with a value.
Regarding that answr how do I deal with Dynamic fields?
Because I am currently using a. dynamic field and I have trouble displaying the values since I have to declare a public property
For example this one
as you see values are not displaying

I’m not sure how this relates to the original question. Did you try to set the type of the property? For example: public string name. I think your error is from setting the property to type void. If you don’t specify a type in php it has to guess. When you set the value to null php thinks you also want the type to be null.
A bit vague, but the dynamic fields looks like this, I am not sure whats the proper way of declaring a property with this one

will $public = name[] do ? I really dont know whats the correct structure
https://www.honeybadger.io/blog/php-type-hinting/. I found an article on type hinting in php. I think understanding how types work will help you understand the error. Your example still makes php guess what the type is. I don’t think this is the answer for fixing everything in your code but it’s an important concept to understand.
Honeybadger Developer Blog
Reducing Errors With Type Hinting in PHP
Errors are unavoidable, but you can always have less of them! In this article, Adebayo Adams walks through how to use type hinting in PHP.