Editor : upload-many and extra field
Editor : upload-many and extra field

I follow example about upload-many.
So the upload of files work properly, but now I want to add an extra field "comment" on table 'files' (ie. for all files I want to be able to specify a specific comment).
On server (Node in my case) & database (SQL): adding field --> OK
On client I don't know how I can add fields and that it will be "associated" with current file. I expect something like :
{
name: "files[].comment",
type: "textarea",
}
Is there a solution (without adding an intermediate table with the comment that join on one side user and other one file.
Answers
Some precision on server, I can add field but with "static " value
instead of 42, I could get data in requete.body but they are not specific for the files but for the parent, and what I'm looking for is set specific element in client side and get it on server side (for example avaibility to add custom field to Upload.Db)
I'm sorry to say that what you are looking for is not currently possible with Editor. In part this is due to to its async upload action - consider for example entering the comment after uploading the file - the file is already in the database.
You could use
preUpload
to add the value from a field (to then replace your42
), but that wouldn't solve the issue I mention above. The only way to do that would be to have a table specifically for the uploaded files, allowing direct editing of that, and then link to that table from your other one.Sorry I don't have better news atm.
Allan
Thank's, so I will use 2 different tables
The first one for upload, which allow to add/delete element
and the 2nd one, the "real table" with other fields for editing.
Basic information (filename) will be inserted in 2nd table "automatically" during upload with a custom action like this.
On my datatable I will add the 2nd table in one cell to display and edit data
So for adding data it will be done in 2 step first upload (by editing row in main datatable), 2nd one complete field in "child" datatable.
Do you think it's a good solution (even if i'm not sure I'm clear) ?
Yes, that sounds good to me (assuming I've understood correctly
),
Allan