expiring downloadable files

  • OK, lets assume I have a zip file that someone might actually paypal me a dollar to buy access it.

    I don't want them to have access after two weeks or so, because they might pass the link around.

    would you tackle it on a per-user basis, and create a GUID and file for each user that "bought" the item, or just give them access to a folder for a period of time?

    here's my thoughts to poke fun at, assuming access to one folder, and if you paypal-ed it, you get an email with http path to it:

    1. Create a calendar table with the date and a NEWID, say with 30 entries, one for each day 15 days before "today" and 15 days "into the future".

    2.Create a Job that does the following:

    creates a folder on the server based on the above NEWID from the database and put a copy of the zip file there, ie

    D:\SomeFolder\F25BA71D-6E73-454A-99BF-E5B55009A655\SomeZipFile.zip

    3. a separate job runs once a day to delete records and folders thathave the calendar column less than getdate() -14...so the folder and it's contents "expire" by getting deleted after a period of time.

    this process would also create one new record, basically getdate + 15 , as well as the first process of creating a folder with the NEWID name and copying the file there, so there is always 30 days worth of downloadables.

    4. Some other process might check to see if a file has been downloaded more than 10 times for example, and "expire" it early due to download abuse.

    coding is no problem...it's logic holes or better ideas I'm looking for. anyone use a "better" way than what I'm kicking around?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi Lowell

    Some questions...

    Lowell (5/19/2009)


    OK, lets assume I have a zip file that someone might actually paypal me a dollar to buy access it.

    Is the ZIP file different for each consumer or is it always the same file?

    would you tackle it on a per-user basis, and create a GUID and file for each user that "bought" the item, or just give them access to a folder for a period of time?

    It depends.

    How does the user access the file? Do you use a FTP-Server or do you offer an own web-page?

    here's my thoughts to poke fun at, assuming access to one folder, and if you paypal-ed it, you get an email with http path to it:

    1. Create a calendar table with the date and a NEWID, say with 30 entries, one for each day 15 days before "today" and 15 days "into the future".

    2.Create a Job that does the following:

    creates a folder on the server based on the above NEWID from the database and put a copy of the zip file there, ie

    D:\SomeFolder\F25BA71D-6E73-454A-99BF-E5B55009A655\SomeZipFile.zip

    3. a separate job runs once a day to delete records and folders thathave the calendar column less than getdate() -14...so the folder and it's contents "expire" by getting deleted after a period of time.

    this process would also create one new record, basically getdate + 15 , as well as the first process of creating a folder with the NEWID name and copying the file there, so there is always 30 days worth of downloadables.

    4. Some other process might check to see if a file has been downloaded more than 10 times for example, and "expire" it early due to download abuse.

    Either I didn't understand you or it seems to be a little bit complicated. My suggestions:

    1.) Don't put the file into a accessible directory on your web-server.

    2.) A table with columns (ProductId, PayPalGuid, PurchaseDate, DownloadCount)

    3 a.) If your consumers are registered users, what about a "Your downloads" page? Seems to be more fancy than a simple URL. While rendering the page just query the table for payed products which are not expired (by date or downloads) and show download-links to a "download.aspx" (see below)

    3 b.) If your consumers are no registered users. Use something like a "download.aspx" (.php, ....) which gets the GUID as parameter. Query the database if the specified GUID is valid and not expired. If everything is okay use a Response.Write to directly stream the ZIP file.

    This would also work if the files are different for each user. Just store them in a not public accessible directory and stream then on-demand.

    Hope this helps

    Flo

  • Did this help?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply