Closed matibaski closed 7 years ago
Looks to me like you've failed to set an array of configuration for your image_file
field. This means that instead of your field being the array key, it's instead the value.
[0 => 'image_file'];
// vs
['image_file' => $myConfigArray]
Hi, I'm also getting the exact same error and I've set the filed config correctly...
In JobsTable.php ` $this->setTable( 'jobs' ); $this->setPrimaryKey( 'id' ); $this->addBehavior( 'Timestamp' );
$this->addBehavior( 'Josegonzalez/Upload.Upload', [
// You can configure as many upload fields as possible,
// where the pattern is `field` => `config`
//
// Keep in mind that while this plugin does not have any limits in terms of
// number of files uploaded per request, you should keep this down in order
// to decrease the ability of your users to block other requests.
'data_file' => [
'fields' => [
'dir' => 'file_dir'
]
],
'nameCallback' => function ( $data, $settings ) {
return strtolower( $data[ 'name' ] );
},
] );
`
Stack trace: ` 2017-08-24 05:15:48 Error: [InvalidArgumentException] Invalid data type, must be an array or \ArrayAccess instance. Request URL: /admin/jobs/bulk-upload Referer URL: http://myproject.localhost/admin/jobs/bulk-upload Stack Trace:
`
@sourjya You've defined nameCallback
as a field and not as a option within a field. Please have a look in the documentation.
I'm receiving following error:
My setup looks like this:
I didn't do nearly anything at all, just tried to get it running out of the box.
My table: