[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Download finished control with PHP

Posted on 2011-10-20
Medium Priority
Last Modified: 2012-05-12
Im coding up some stuff and I need to control when the user finished the download. Actually I need to be under control of the mbs downloaded too.

So basically:
1) Be aware when the media has succesfully been downloaded (1mb+ the files)
2) Control how many mbs have been download.

Thanks in advance everyone :)
Question by:SidGBF
LVL 22

Accepted Solution

Om Prakash earned 2000 total points
ID: 36999201
LVL 111

Expert Comment

by:Ray Paseur
ID: 36999290
You cannot control this.  You cannot know when the user finished a download.  Sorry, but this is just the way client-server models work.  Clients make requests and servers make responses.  It is a stateless protocol.  The only things you can know are the things you can set and detect on the server side of things.

You might want to create a data base that has rows for each request.  As a client makes a request, you will log the request into the data base.  You will keep information about the client (user name, password, etc.) and about the request for a downloadable file.  You can detect the file size and the file name, and you can store these things.  You can send the file in response to the client's download request.  But you cannot know whether the download started or finished at the client's end of things, unless the client performs some requested activity and sends an affirmative response back to the server.  

In financial transactions we encode the message into an md5() string and send the encrypted message along with the md5() string.  The recipient of the message creates an md5() string of the received message.  If the two md5() strings do not match, some part of the message is missing or damaged, and they can request a new message.  This will give each party a clear view of the communication, and a way to know exactly when the media has been downloaded and how much data has been downloaded.  But it may be difficult to convince your clients to engage in this kind of "mating dance."

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month19 days, 2 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question