File Upload - Delete
File Upload - Delete
Would it be possible to provide a simple example of how to build a custom delete button that would perform the actual deleting of a file uploaded?
Example: In the child row (using responsive) I have it set to always show the file names that have been uploaded to that row and have it set so they could download them again if needed. I simple want to put a 'X' to each file name that the user could click on to delete the file. Currently the only possible way is the select the row and click on the editor edit button, which can sometimes be an annoyance. Is there anything that would help me with this and coding what needs to be done after catching the click event?
This question has an accepted answers - jump to answer
Answers
Hi,
What you are looking for isn't a direct function of Editor - some custom code would be needed to perform that action. An ajax request with the file id for example - it would update the files table (assuming you have one), delete the file and also update any references to that file from other tables. Finally you'd need to update the data for that row in the DataTable.
Allan
Thanks Allan, that's kind of what I figured. Can you answer one other question for me in regards to this....
Currently I have not coded anything to interfere with the way Editor performs its actions but when a user does select a row, clicks on the edit button, and then deletes a uploaded file... It deletes the relationship (i.e. the documentID from the 'charges' table) but it does not delete the row from the 'uploads' table. Do I have to tell it to do this?
There is an
Upload->DbClean()
method which can be used for that. It is described in the documentation.Allan