delete uploaded files

delete uploaded files

crush123crush123 Posts: 417Questions: 126Answers: 18
edited April 2015 in Editor

further to a previous question in this thread https://datatables.net/forums/discussion/27034/

i have my file upload working successfully, but want to ability to delete the file on deletion of the row in the database

on my ajax page, i am checking for post of delete as follows...

if ( isset($_POST['action']) && $_POST['action'] === 'remove' ) {

...

}

but cant work out how to retrieve the name of the document, as the data object is not sent on remove http://editor.datatables.net/manual/server

(on edit, I would use something like $_POST['data']['tablename']['fieldname'])

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    You would need to query the database for each row that is being deleted to get the field name and then unlink() it.

    Editor doesn't send the row data on delete as it isn't normally needed. However, that is likely to change in 1.5 where I will have it send the data for the rows to be deleted for exactly this for of reason.

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    of course!!

    I will just use the id returned to query my table.

    Thanks again

This discussion has been closed.