Re: [PHP] downloading files

2005-05-05 Thread Greg Donald
On 5/5/05, Cima <[EMAIL PROTECTED]> wrote: > i've uploaded some files into my postgresql db, via a php script, and now > id like to give a user the posibility to download these files via a php > script. what would be the best way to do this bearing in mind that the files > are 'integrated' into th

Re: [PHP] downloading files

2004-08-23 Thread Aaron Todd
I did exactly what you said but its not working for me. I am getting the following error: Warning: filesize(): SAFE MODE Restriction in effect. The script whose uid is 20373 is not allowed to access /var/www owned by uid 0 in /home/virtual/site341/fst/var/www/html/test.php on line 3 I checked

Re: [PHP] downloading files

2004-08-20 Thread Ramil Sagum
Aaron Todd wrote: I have been using the following code to try to make it work: The webroot of my site is at: /var/www/html So far this will create a new file on my computer where ever I want, but it does not download the contents of the file. Any suggestions? Thanks, Aaron It seems that PHP can

Re: [PHP] downloading files

2004-08-20 Thread Aaron Todd
I have been using the following code to try to make it work: The webroot of my site is at: /var/www/html So far this will create a new file on my computer where ever I want, but it does not download the contents of the file. Any suggestions? Thanks, Aaron "Octavian Rasnita" <[EMAIL PROTECT

Re: [PHP] downloading files

2004-08-19 Thread Octavian Rasnita
You can put the files that need to be downloaded in a directory somewhere outside of the web server root, but in that case your PHP program will need to read the file and print it to the browser, and it will also need printing the HTTP headers: Content-type: application/octet-stream Content-dispos

Re: [PHP] downloading files

2004-08-19 Thread Mattias Thorslund
Aaron Todd wrote: I posted a simular question before and never really got an answer. The post drifted off into some other valuable information, but I still have the same question. I am trying to create a site with file downloads. The files on the server that are to be downloaded need to be protec

Re: [PHP] downloading files

2004-08-19 Thread Mario Micklisch
Hi Aaron, [..] The download files are in a directory protected by htaccess which it is my understanding that PHP can go underneath htaccess to get access to the files. My problem is where do I put this directory? I was already told to put it outside the web root directory, [..] Both are goo

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

Re: [PHP] Downloading files - Plz hlp

2003-02-23 Thread Ernest E Vogelsinger
At 00:52 24.02.2003, Anthony Rodriguez said: [snip] >In PHP, is there a way to allow the user to download a demo file (e.g.: >sample.exe) to their computer? And, then, automatically return to the Web >site? [snip] A

Re: [PHP] Downloading files

2003-02-23 Thread Justin French
on 24/02/03 1:01 AM, Anthony Rodriguez ([EMAIL PROTECTED]) wrote: > In PHP, is there a way to allow the user to download a file (e.g.: > sample.txt) to their computer? And, then, automatically return to the > PHP-generated Web page. why do you need to re-run the page? it can be done with a bit o

RE: [PHP] Downloading Files

2002-06-25 Thread John Holmes
> I want to protect files from being downloaded and only allow people to > download files which they have access too. I've done all the access > control > etc... but whats the best way for the user to download the file... Can you > "paste" the file directly into the header? (get the file from the

Re: [PHP] Downloading Files

2002-06-25 Thread Francis
got it!! :) $filename = "backup.tar"; $download_file = "/absolute/path/backup.tar"; $fh = fopen("$download_file", "r"); header("Content-Type: application/x-tar"); header("Content-Disposition: attachment; filename=$filename"); fpassthru($fh); exit(); Thanks a lot!! :) "Justin French" <[EMAIL PRO

Re: [PHP] Downloading Files

2002-06-25 Thread Justin French
Either of these options will work fine. There was MASSIVE disscussions about this a few weeks back -- check for threads started by myself in the archives. Justin French on 26/06/02 12:35 AM, Francis ([EMAIL PROTECTED]) wrote: > I want to protect files from being downloaded and only allow pe

Re: [PHP] Downloading files

2002-04-09 Thread Jason Wong
On Wednesday 10 April 2002 08:54, Jim Koutoumis wrote: > Using this method,.. works OK if you choose to save the file, however if > you choose to open the file you get a weird behaviour where IE says it > can't find the file and a subsequent prompt to create a new one. Does > anyone know why it do

Re: [PHP] Downloading files

2002-04-09 Thread Jim Koutoumis
Using this method,.. works OK if you choose to save the file, however if you choose to open the file you get a weird behaviour where IE says it can't find the file and a subsequent prompt to create a new one. Does anyone know why it does this and how to overcome it ? At this stage I've resorted t

Re: [PHP] Downloading files

2002-04-09 Thread Scott Houseman
Try this: As you give the client Content-Type: application/save-as - it will not know what mime type the file is, and the browser will give the user a save-as prompt. This works in explorer - I haven't checked it in Mozilla etc - so you might have to tweak it a bit. Cheers Scott - Origina

Re: [PHP] Downloading files

2002-04-09 Thread Matt Williams
On Tuesday 09 April 2002 11:20, Declan Kenny wrote: > Hi folks, > > Ok I am trying to make a download area for files (including word files). > How do I force a download of a word document rather than have it opening in > IE? > > Declan You don't. This option is set in windows exploror. as part o