Aydin Hassan
Aydin Hassan

Reputation: 1475

Zend post view delete/unlink

Hi I have a zend view which echo's an <img src> tag, I want to delete this image file after the page has been rendered, any ideas how I might do this?

Does the flow return to the controller after the view has been executed or does it just finish there? I tried to unlink the file after the echo but of course the html has not been rendered at that point.

So what I'm asking is there some sort of post view action I could use to unlink the file after the html has rendered?

Upvotes: 0

Views: 493

Answers (1)

dinopmi
dinopmi

Reputation: 2673

The image will need to be there at least until the browser retrieves it, in order to be rendered. At that point, your server request has already finished.

A common way to remove files after the request has finished, is by using a "cleanup" cron task to be executed periodically.

Hope that helps,

Upvotes: 2

Related Questions