Editor Fileupload not passing ID

Editor Fileupload not passing ID

dioceseofnorwichdioceseofnorwich Posts: 1Questions: 1Answers: 0

HI,
I can not figure out how the row ID is passed when completing a file upload. For example we are using :
{
label: "Press release PDF:",
name: "equip_cert",
type: "upload",
display: function ( val ) {
return table.file( 'files', fileId ).fileName;
},
dragDrop: false,
clearText: 'Remove file'
}

We have our own server side code that uploads the file, but i can't see anyhtung that passes the ID so we know which row to update. Is there something we can add to pass the Row ID as well as the file?

Thank you!

Answers

  • allanallan Posts: 63,208Questions: 1Answers: 10,415 Site admin

    Its in the JSON that needs to be returned by the server. There should be a upload object that has a single property called id which gives the id of the file. There also needs to be a files object like when the table is first loaded. Unfortunately, at the moment this needs to contain information about all of the available files, not just the newly uploaded file (that will be fixed in the next version).

    Example JSON:

    {
        "data": [],
        "files": {
            "files": {
                "1": {
                    "id": "1",
                    "filename": "Screen Shot 2015-05-27 at 12.01.44.png",
                    "filesize": "20597",
                    "web_path": "\/upload\/1.png",
                    "system_path": "\/home\/datat\/public_html\/editor\/upload\/1.png"
                }
            }
        },
        "upload": {
            "id": "1"
        }
    }
    

    Allan

This discussion has been closed.