I am resending this to the list so that they may also help, in the 
future be sure to group reply so that happens as they may be able to 
help where I can't.

See inline comments...

Octavian Rasnita wrote:
> Hi,
> 
> I think that if I would do that, it will happend something like:
> 
> 1. The visitor will activate the script.
> 2. The script will create the lock file and it will print the file to the
> browser.
> 3. The visitor will be asked if they want to save the file.
> 4. They will answer yes, and the download will begin.
> 5. The visitor will close the browser, or they will move to another page
> while the file is downloading.

If you are using the cgi script to print the binary of the file (as 
opposed to redirecting to it, etc.) in other words the script is acting 
like a pipe, then while that pipe is open (they are downloading the 
file) then the script is still running and the lock file will still 
exist, and hence you know they are downloading.


> 6. If the download is cancelled, the lock file from the server is not
> deleted.

It is my understanding (help me here group) that the browser would send 
a signal to the server that it doesn't want anymore data which would 
then end the print and the rest of the code would be executed and the 
lock file deleted, however if this is not the case, you *should* be able 
to no matter what call an (is it?) END block that will be executed *no 
matter what* happens before the perl interpreter destroys the process 
which is then where you could handle your removal of the lock file.


> In fact, I am not sure if the file is deleted, even though the download is
> completed.
> 

   When they are finished downloading the file, aka the information has 
finished printing, then control will return to the code immediately 
following the print (download of the file) which is where you can then 
unlink the download, or simulate it finishing.  Again this can *always* 
be handled in the block that is executed whenever the process 
terminates, if the lock isn't removed prior to taht point.


> Please tell me if I am wrong.
> 
> In fact, after downloading, I want to delete the real file, not only the
> lock file.
>

If you can get one to delete, the other is obvious.


> Thank you.
> 
> Teddy Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> ----- Original Message -----
> From: "Wiggins d'Anconia" <[EMAIL PROTECTED]>
> To: "Octavian Rasnita" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 24, 2002 4:47 AM
> Subject: Re: Checking if a file is downloading
> 
> 
> 
>>There may be a direct way but I am not aware of it.  As a proposed
>>solution you could have the user call a perl script that has the
>>following steps:
>>
>>1) create a lock file (or something similar)
>>2) open the file that is to be downloaded
>>3) print the proper header for that file type
>>4) print the file
>>5) remove the lock file
>>
>>Since the data in the file is being passed through the perl script at
>>the point before the lock file is removed, as long as that download is
>>occuring the file will exist, so then checking for the file would tell
>>you if it is being downloaded....... (watch out for browser time outs,
>>they shouldn't happen but you should test this!)
>>
>>Obviously you could make a dynamic named lock file, etc. to do things
>>like tracking who is doing the downloading, how many, etc.  This also
>>depends on teh size of the downloadable file, I am assuming you are
>>talking about a sizeable download.
>>
>>Hope this helps,
>>
>>http://danconia.org
>>
>>
>>Octavian Rasnita wrote:
>>
>>>Hi all,
>>>
>>>I want to check if a certain file is downloading  in this moment by a
>>
> page
> 
>>>visitor.
>>>Is it possible with Perl?
>>>
>>>I want to tell me true if the file is in the downloading process, and
>>
> false
> 
>>>if the download has finished.
>>>
>>>Thank you.
>>>I hope it is possible.
>>>
>>>Teddy Center: http://teddy.fcc.ro/
>>>Mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>>
>>
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to