Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 25th, 2003, 02:24 PM
Authorized User
 
Join Date: Jul 2003
Location: Antwerpen, , Belgium.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default File size on customer side

Hi all,
I'm looking for a solution for the following problem.

A customer logs in to the webserver and see a list with requested file where he payed for. Once the download was sucesfull he cannot download the file a 2th time.

Any idea how to solve this practical ?

Thanks,
Vincent


Reply With Quote
  #2 (permalink)  
Old August 25th, 2003, 03:36 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This is a tough one for a couple reasons. I don't know if there is a reliable way to provide only single access thru client-side code. If the person refreshed the page, they would be able to "reset" the lockout. Normally, this kind of thing would be accomplished by keeping track of when the file has been downloaded on the server side. Usually, you'd provide a link to a page that returned a binary stream of the desired file instead of providing a link directly to the file. (a direct link would of course not secure it from being downloaded twice.) However, one then encounters the issue of a failed download. If you mark the file as "downloaded for user x" and their download breaks halfway thru then you have a problem. Not sure how people solve this issue. Perhaps someone else has a suggestion.

Peter
Reply With Quote
  #3 (permalink)  
Old August 25th, 2003, 04:16 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I posted a suggestion in another forum, suggesting to stream the file as well, after the database has been checked for sufficient permissions to download it again.

One solution to overcome the failed download is to set a flag in the database after the file has been completed. I think the BinaryWrite method (which you use to stream the file) is a blocking call; that is, the function will be performed on the main thread, blocking other code following it. If the line directly after the BinaryWrite performs a database update, you can be pretty sure that once you do the update, you have a valid download.

(See Vincent, cross-posting causes more problems than it solves. Now the questions and answers are all over the place, forcing everyone to follow a couple of threads and do cross-referencing all the time.... ;))

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Verifying uploaded File Size in Client-side Ushhh ASP.NET 1.0 and 1.1 Professional 5 August 30th, 2006 07:13 AM
How to check file size on customer side vincentvdm Classic ASP Professional 3 August 27th, 2003 12:23 AM
File size on client side vincentvdm Classic ASP Basics 0 August 25th, 2003 02:19 PM



All times are GMT -4. The time now is 01:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.