Jump to content

Help for php out stream


masphp

Recommended Posts

Hi

I have some code like :

 

header("Content-type: application/octet-stream");

header("Content-Length: " . filesize("$ffolder/".$_REQUEST['filename']));

header("Content-Disposition: attachment; filename=\"$_REQUEST[filename]\"");

readfile("$ffolder/".$_REQUEST['filename']);

mysql_query("delete from $table1 where userid='$_REQUEST[userid]'")or die(mysql_error());

 

So You could know from that code , that it will open browser downlod dialog that has download and cancel button , So If User Click On Download And let the file to download completely , other codes below readfile will run That i Want it But if user click On cancel or terminate download and not allow download the file completely , Script shutted down and below line :

mysql_query("delete from $table1 where userid='$_REQUEST[userid]'")or die(mysql_error());

will not execute, So I want Do some thing that in all way that code executed finally if user downloded file completely or not

I even add

ignore_user_abort(true);

and even other way to my code but no one worked for me

please help me!

 

And  I need deleting the row when he / she downloded file ???

Link to comment
https://forums.phpfreaks.com/topic/44770-help-for-php-out-stream/
Share on other sites

      header("Content-type: application/octet-stream");
     header("Content-Length: " . filesize("$ffolder/".$_REQUEST['filename']));
     header("Content-Disposition: attachment; filename=\"$_REQUEST[filename]\"");
     readfile("$ffolder/".$_REQUEST['filename']);
     mysql_query("delete from $table1 where userid='$_REQUEST[userid]'")or die(mysql_error());

:P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.