Jump to content

any idea how i could do this !!


yami007

Recommended Posts

well what i am trying to do is preventing the user from downloading the same file twice or when they cancel the download.

You could make it so it records the ip address while it is interacting with your file and when the connection is destroyed disable rights to the file for that ip address.

Which I don't know how to actually put in php..

sorry i'm a failure!

Link to comment
Share on other sites

There are many ways to do it, two i will mention here:

 

1-Password protected pages, user can login to the system and download the file..save the entry into a table for that user and next time check if that user already downloaded the file.

 

2- If not password protected pages, then you can use/save IP. But they can download from another location or restart router/modem in case of dynamic IP from their ISP.

Link to comment
Share on other sites

Thanks For You : corrupshun  And mmarif4u  But I Don't Mean This

 

I Mean I Want To Know If User Download The File Or Cancel It, And I Delete This File (The File Is Temporary).

I hope that I have brought you the idea

Link to comment
Share on other sites

How is the user getting the file. From a FTP client? From a php script? If from a script then when the download is complete then just delete the file.

...FTP stuff...(see the php manual)
$result = ftp_fget($connect $local,"$dl_file", FTP_BINARY);
if (!$result) {
echo "download failed!";
} else {
unlink("$dl_file");
}

As for a canceled DL. Only if you have a cancel button. Otherwise you have no way of positively knowing. One other problem is that not all transfers, even when completed, result in a viable file. Files can be corrupted enroute. If its a text or graphic it may not be much of a problem but if its an executable then you will have an issue.

 

 

HTH

Teamatomic

Link to comment
Share on other sites

This Is Not What I Mean

 

I Have PHP Upload Script

 

And Want To Do Like Rapidshare Or Zshare Download

 

When The User Or The Guest Download The File  I Have To Delete It Because The File Is Temporary.

Will Now I Want To Know How To Check If The User Or The Guest Is Close The Connection With The Download File Not With The Page .

 

Thanks In Advance Man.

Link to comment
Share on other sites

You would need to store your files in a location outside of your web root. You would then need to use a force download script (such as the one within the Faq/Code Snippet board, though you would need to customize it to keep track of what files a user has downloaded (by recording it within a database).

Link to comment
Share on other sites

But When I Can Give a Force Download Script

Huh!..

You use a force download script so the downloads are controlled by a PHP script,  after the readfile function has been used you can simply unlink the file, if the script fails to complete the readfile() the the unlink will not be used thus the file remains, if the readfile() is complete then the unlink will be used thus removing the file!

 

PS your initial caps button seams to be stuck!

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.