How to authenticate users before downloading files?

tzaxo1

New Member
For example, if users want to download /webroot/files/bigimage.jpg, they are given a URL www.domain.com/download.php?filename=bigimage.jpg. Then,[*]How to prevent unauthenticated usersto access the file bigimage.jpg?[*]If an authenticated user visits thatURL, I want to trigger the downloadbehavior of browsers (e.g., in IE,show the dialog with "Open", "Save"and "Cancel" buttons) instead ofdisplaying the image in browsers.How to do this?EDIT: Make the question more clearer.I am using LAMP stack. For Q1, I am not asking how to do authentication, I am asking how to prevent users access the file directly. Also, reading contents of the whole file and echo them is resource extensive. Is there better solution?
 
Back
Top