Re: [PHP] Downloading files outside the webserver

2003-03-05 Thread Daniel Silva
The problem was solved. I added a call to the exit() construct at the end of the function and haven't had any more problems since. I would like to thank everyone who helped me. Cheers, Daniel "Daniel Silva" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. > > I tried what y

Re: [PHP] Downloading files outside the webserver

2003-03-04 Thread Daniel Silva
Hello. I tried what you suggested and it's working alright. The problem is, that it doesn't always work. I adapted your suggestion to what I needed. Instead of creating a file, I made a fuction that does basically the same. All listed files are links that enable the user to download them. So far

Re: [PHP] Downloading files outside the webserver

2003-03-04 Thread Daniel Silva
There's actually a function in (PHP 4 >= 4.3.0) that returns a file's MIME type. Here it is: string mime_content_type ( string filename) "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes, sure, but you many times won't know the mime type and might be > forced to

Re: [PHP] Downloading files outside the webserver

2003-03-04 Thread Marek Kilimajer
Yes, sure, but you many times won't know the mime type and might be forced to use application/octet-stream. You can do if(dirname(realpath($user_files_dir . $_GET['filename'])) == $user_files_dir) as a security check Daniel Silva wrote: That is a very nice solution, the problem is, the files ar

Re: [PHP] Downloading files outside the webserver

2003-03-04 Thread Daniel Silva
That is a very nice solution, the problem is, the files are stored on disk, not on the DB. I suppose it can be addapted to work with the disk, can't it? Cheers, Daniel "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > create a download php file: > > > $res=mysql_q

Re: [PHP] Downloading files outside the webserver

2003-03-04 Thread Marek Kilimajer
create a download php file: $res=mysql_query("select * from user_files where filename='$GET['file']'"); if($res && mysql_num_rows($res)) { $file=mysql_fetch_assoc($res); if($_GET['downaload']) { header('Content-Type: application/octet-stream'); header('Content-disposition: a