Hi All,
I'm trying to write a secure script that will only allow a user to view a file stored in a database if they have access.
To clarify:
I'm storing files in a database.
Only "registered login" users will be able to view/download these files.
So what I'm doing is using the header() function to file stream the data out of the database.
The problem I'm running into is that I make a call to 'session_start()' at the top of the script so that I can make use of the session variables. But then the header() call I make will not operate correctly because teh session_start() has already sent some data.
The following sample code WILL NOT work:
session_start();
header("Content-Type: $fileDataType");
header("Content-Length: $fileSize");
header("Content-Disposition: attachment; filename=$filename");
function_that_ouputs_data();
Any help would help!
Thanks!