Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Download through a PHP script

    How to make download of a file from a PHP script?
    Generally, I can download files using 'download accelerator' as I know url of the file e.g., ~/archive.tar.tz

    But sometimes ( raretimes ), I can't do that e.g., OSoft Web site.

    Actually, we're making audios and videos available only to a valid user. If that files reside in filesystem, then, what are the tricks to pervent them from people, and only available to desired people through a PHP script?

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You might be able to do it with a .htaccess file to restrict access, I'm not sure, but personally I've found it simple and effective to server the files either from outside the root of the website or to store them in a database and just retrieve and server them that way (after first checking the user is logged in and authorised to view the file, of course).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •