dan3460
316
5
Laravel

Delete file after viewing or disconecting

Posted 11 months ago by dan3460

I'm presenting a PDF file on a iframe to the user. This file is stored on the storage folder and i make a copy to the public folder for presentation. I'm trying to figure out the best way to delete such file after the user has viewed the file or it has disconnected. The way that i have solved for now is to delete any file that is X hours old. What i would like to do is if the user leaves the page, delete the file. Or if the user logout, delete the file. Or if the user looses connection, delete the file.

Please sign in or create an account to participate in this conversation.