Search code examples
xpagesxpages-ssjs

File Download Control


Is it possible to access the currently deleted file of a <xp:fileDownload> control?

enter image description here

Im am searching for something like onDelete or beforeDelete event?

I need this, because I have to save the deleted files in a history log.

Thanks in advance

UPDATE (useful answer of a similar problem):

https://stackoverflow.com/a/11941037/4717072


Solution

  • sorry this is all from memory, i may update the answer tomorrow with any corrections (not near my computer at the moment)

    instead of thinking in terms of the download control, maybe you could think in terms on the domino document data source.

    when you click the delete link of the file download control, it does not immediately delete the attachment but it marks the attachment 'to be deleted' the next time the document is saved.

    this information is managed within the domino document data source and not within the control.

    there is an 'attachment list' for each attachment field which keeps track of the current state of each attachment in that field. example states are 'in document' 'pending upload' 'deleted'

    so maybe in a before save / after save event of the document you could check the attachment list and the state of each attachment and figure out which ones were deleted

    the appropriate method to get the attachmentlist is something like

    doc.getAttachmentList('yourfield')