Welcome Guest, Not a member yet? Register   Sign In
Delete file after download
#7

(07-10-2018, 04:25 AM)Pertti Wrote:
(07-10-2018, 01:26 AM)omid_student Wrote: I used unlink but not working
I try use ignore_user_abort(true); but file not deleting

If file uploads, user can't really abort your PHP script executing. Once they access URL through their browser, even if they close the browser, the script will still finish what it's doing.

I'd check that you are trying to delete the right file.

Enable error messages and echo out some of your variables to check that it does actually hold data that you expect to be there.

PHP Code:
$file 'path/to/file.txt';

// ...

error_reporting(E_ALL);
echo 
$file;
unlink($file); 

Can i read file content to variable and delete file and echo content?
Reply


Messages In This Thread
Delete file after download - by omid_student - 07-10-2018, 01:04 AM
RE: Delete file after download - by Pertti - 07-10-2018, 01:14 AM
RE: Delete file after download - by omid_student - 07-10-2018, 01:26 AM
RE: Delete file after download - by Pertti - 07-10-2018, 04:25 AM
RE: Delete file after download - by omid_student - 07-10-2018, 05:05 AM
RE: Delete file after download - by Pertti - 07-10-2018, 05:51 AM
RE: Delete file after download - by omid_student - 07-11-2018, 04:50 AM
RE: Delete file after download - by InsiteFX - 07-10-2018, 03:27 AM
RE: Delete file after download - by omid_student - 07-10-2018, 05:04 AM
RE: Delete file after download - by omid_student - 07-10-2018, 05:06 AM
RE: Delete file after download - by Pertti - 07-10-2018, 05:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB