Upload Unknown file table name
Upload Unknown file table name
marco.digioia
Posts: 8Questions: 4Answers: 0
in Editor
Hi,
i have a simple page with a record for upload a file.
The server-side code is:
Editor::inst( $db, 'kedb_documents' )
->fields(
Field::inst( 'ID'),
Field::inst( 'PROJECT' ),
Field::inst( 'NAME' ),
Field::inst( 'ARGUMENT' ),
Field::inst( 'KEYWORD' ),
Field::inst( 'DESCRIPTION' ),
Field::inst( 'NOTE' ),
Field::inst( 'FILENAME' )
->upload( Upload::inst( '/home/documents/__ID__.__EXTN__' ) )
->setFormatter( 'Format::nullEmpty' )
)
->process( $_POST )
->json();
and the client-side cose is:
fields: [
{....},
{
label: "Filename",
name: "FILENAME",
type: "upload",
display: function ( val ) {
return table.file( 'kedb_documents', "ID" ).fileName;
}
}
]
when i try to edit the row the error returned is "Unknown file table name kedb_documents". Why?
Thank you
This discussion has been closed.
Answers
The error message is a little misleading there - apologies. The issue is that there is no
Upload->db()
call which will give the upload class information about the database table to store the file meta information.Detailed information about that can be found in the documentation.
Allan
whe i add the code below
Where am I doing wrong? The line 30 is ->db(
There isn't a
Field->db()
method - thedb()
method is on theUpload
class.If you scroll down the page a little from the link I gave above it shows an example.
Allan
thanks. i add the pack, and try again
it's all ok