Jump to content

[SOLVED] help!! there must be a way..


jmurch

Recommended Posts

I got 1/2 of my earlier post answered, but this part is still a puzzle:

 

 

I am using the following to generate an xml doc to the users browser:

 

$fp = fopen("document.xml", 'w+');

$str = ($xml_frame->Fields('top_xml').$content->Fields('xml').$content->Fields('xml').$xml_frame->Fields('bottom_xml'));

fwrite($fp, $str);

fclose($fp);

header( 'Location: http://www.website.com/document.xml') ;

 

I would like to delete 'document.xml' after it has been loaded to the user's browser. Unlinking the file kills it before it loads and sleep hangs everything. I there a way to detect when it's finished downloading to the user?

 

Thanks

 

 

Link to comment
Share on other sites

A standard method is:

 

1.  Generate a random name for each generated document

2.  Store them all in one directory

3.  Have a script run regularly that checks for old files (using fstat()) and deletes anything older than a fixed limit, say 1 hour.  You can run the script from cron, or have it run each time a user accesses a particular script.

 

That doesn't detect when the file is downloaded, because that's a very difficult task.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.