Editor node.js - File upload example error - 'FileName' of undefined
Editor node.js - File upload example error - 'FileName' of undefined
Editor node.js - File upload example error - 'FileName' of undefined. I'm testing the file upload function but getting an error:
TypeError: Cannot read property 'FileName' of undefined
I tried the example from here:
https://editor.datatables.net/manual/nodejs/upload
That's my setup:
let {
Editor,
Field,
Validate,
Format,
Upload,
Options
} = require('datatables.net-editor-server');
let editor = new Editor( db, 'news', 'id' )
.fields(
new Field( 'news.id', 'id' ),
new Field( 'news.cruser_id', 'cruser_id' ),
new Field( 'news.image', 'image' )
.setFormatter( Format.ifEmpty(null) )
.upload( new Upload( __dirname + '/public/uploads/{id}.{extn}' )
.db('image', 'id', {
fileName: Upload.DbType.FileName,
//fileSize: Upload.DbType.FileSize,
//web_path: '/uploads/{id}.{extn}',
//system_path: Upload.Db.SystemPath
})
)
)
Why is FileName undefined and how to get it work?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The docs should be updated ... it must be:
Thank you - that's really an error in the code. I'll add an alias so
Db
orDbType
will work.Allan