Download finished control with PHP

Posted on 2011-10-20
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


    Author Comment

    LVL 107

    Expert Comment

    by:Ray Paseur
    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    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 is …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now