[PHP] Need advice on downloading files and databases

2002-12-02 Thread Dara Dowd
Hello everybody,
Newbie here...basically I need to develop a site that will allow users to 
download files, e.g
Word docs, XL sheets, and I would like to know whether it is better to store 
the entire file in a database, 
or just the filepath, or even whether I need a database at all. Is it possible 
to link to a file on a remote server if the file isn't in the root directory? Any 
advice gratefully received.
Thanks,Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] fopen over a network

2002-12-04 Thread Dara Dowd
Hello, 
I'd like a user to be able download a file from a file server on my LAN. 

Using  works ok, but this simply displays 
the file in the browser and I want to force the download dialog box to appear.


So now i have , and i want to do something like 
fopen("file://server/directory/filename",rb") but i just get an invalid argument 
warning.
Am i on the right track?Is there a way around this?

Cheers,
Dara



-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] fopen over a network

2002-12-04 Thread Dara Dowd
Thanks for the advice lads but I realise I should have been clearer. I know about 
header(etc..) so displaying the download dialog isn't the problem, it's how to get to 
the file on the file server and then open it. The file server isn't a web server.  
This is probably ridiculously easy so I hope I'm not wasting your time. I don't want 
to@use the 'right-click' option, I want something similar to@opening attachments in 
hotmail for example. Here's what I have anyway.


Cheers, Dara
- Original Message -
From: Philip Olson <[EMAIL PROTECTED]>
Date: Wed, 4 Dec 2002 19:10:31 + (GMT)
To: Elkan <[EMAIL PROTECTED]>
Subject: Re: [PHP] fopen over a network


> 
> Please reread the documentation found here:
> 
>   http://www.php.net/header
> 
> It has a pdf file as an example, modify according
> to your needs.
> 
> Regards,
> Philip
> 
> 
> On Wed, 4 Dec 2002, Elkan wrote:
> 
> > Couldn't you set the Mime-Type on the server for the correct extenstion?
> > 
> > Leif K-Brooks wrote:
> > 
> > > Link them to a page like this to download the file:
> > >
> > >  > > header("Content-type: application/octet-stream");
> > > //Code to display file
> > > ?>
> > >
> > > Dara Dowd wrote:
> > >
> > > >Hello,
> > > >I'd like a user to be able download a file from a file server on my LAN.
> > > >
> > > >Using  works ok, but this simply 
>displays the file in the browser and I want to force the download dialog box to 
>appear.
> > > >
> > > >
> > > >So now i have , and i want to do something 
>like
> > > >fopen("file://server/directory/filename",rb") but i just get an invalid 
>argument warning.
> > > >Am i on the right track?Is there a way around this?
> > > >
> > > >Cheers,
> > > >Dara
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > The above message is encrypted with double rot13 encoding.  Any unauthorized 
>attempt to decrypt it will be prosecuted to the full extent of the law.
> > 
> 
> 

- Original Message -
From: Philip Olson <[EMAIL PROTECTED]>
Date: Wed, 4 Dec 2002 19:10:31 + (GMT)
To: Elkan <[EMAIL PROTECTED]>
Subject: Re: [PHP] fopen over a network


> 
> Please reread the documentation found here:
> 
>   http://www.php.net/header
> 
> It has a pdf file as an example, modify according
> to your needs.
> 
> Regards,
> Philip
> 
> 
> On Wed, 4 Dec 2002, Elkan wrote:
> 
> > Couldn't you set the Mime-Type on the server for the correct extenstion?
> > 
> > Leif K-Brooks wrote:
> > 
> > > Link them to a page like this to download the file:
> > >
> > >  > > header("Content-type: application/octet-stream");
> > > //Code to display file
> > > ?>
> > >
> > > Dara Dowd wrote:
> > >
> > > >Hello,
> > > >I'd like a user to be able download a file from a file server on my LAN.
> > > >
> > > >Using  works ok, but this simply 
>displays the file in the browser and I want to force the download dialog box to 
>appear.
> > > >
> > > >
> > > >So now i have , and i want to do something 
>like
> > > >fopen("file://server/directory/filename",rb") but i just get an invalid 
>argument warning.
> > > >Am i on the right track?Is there a way around this?
> > > >
> > > >Cheers,
> > > >Dara
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > The above message is encrypted with double rot13 encoding.  Any unauthorized 
>attempt to decrypt it will be prosecuted to the full extent of the law.
> > 
> 
> 

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] validate querystring

2002-12-11 Thread Dara Dowd
Hello,
I have a query string like this 
http://server/download.php?fname=name_of_remote_file. The script runs and displays a 
file download dialog box.
Is there a way of validating the querystring to ensure that a user doesn't try 
something like fname=. or fname=.. or fname=? or fname=/, which enable the user to see 
the contents of the remote directory, without resorting to a load of 'if' 
statements.Are there any other special characters i should be aware of?
Cheers,Dara

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] global variables

2003-01-16 Thread Dara Dowd
Is it "better" to pass variables through functions or to simply declare them as global 
within the function's scope?
The variables in this particular case are things like MySQL database connections and 
tablenames.
Thanks,Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] content type header for downloading files

2003-01-28 Thread Dara Dowd
I have the following headers in download.php which forces a download dialog box to be 
opened when a user clicks on a desired file:

header("Content-type: application/octet");
header("Content-Length: $filelength");  header("Content-Disposition: attachment; 
filename=".basename($fname).";");

This works fine with IE, but Mozilla adds a '.php' extension to the filename if i 
choose the save option, and asks me to choose which application to use if I want to 
open the file. The files are binary.
Do I need to change the content-type header? If so, to what? If not, what do I do?
Thanks, Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] content type header for downloading files

2003-01-28 Thread Dara Dowd
No, that doesn't change anything with Mozilla, and as for IE the file is automatically 
displayed in the browser. I actually want the Dialog Box to appear. I think Mozilla 
doesn't know what to do with 'application/octet.'

Dara
- Original Message -
From: Evan Nemerson <[EMAIL PROTECTED]>
Date: Tue, 28 Jan 2003 21:28:19 -0800
To: "Dara Dowd" <[EMAIL PROTECTED]>
Subject: Re: [PHP] content type header for downloading files 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Change
> header("Content-Disposition: attachment; filename=".basename($fname).";");
> to
> header("Content-Disposition: inline; filename=".basename($fname).";");
> 
> 
> On Tuesday 28 January 2003 06:27 pm, Dara Dowd wrote:
> > I have the following headers in download.php which forces a download dialog
> > box to be opened when a user clicks on a desired file:
> >
> > header("Content-type: application/octet");
> > header("Content-Length: $filelength");  header("Content-Disposition:
> > attachment; filename=".basename($fname).";");
> >
> > This works fine with IE, but Mozilla adds a '.php' extension to the
> > filename if i choose the save option, and asks me to choose which
> > application to use if I want to open the file. The files are binary. Do I
> > need to change the content-type header? If so, to what? If not, what do I
> > do? Thanks, Dara
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.0.7 (GNU/Linux)
> 
> iD8DBQE+N2aH/rncFku1MdIRAvilAKCn7xrFd+TeIYYCr99xyH59fih16wCfTCHI
> +7dGxJJU5ikFk/H+zhkZ9hw=
> =bwBj
> -END PGP SIGNATURE-
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] content type header for downloading files

2003-01-29 Thread Dara Dowd
$fname is the name of the file i want to download. It works in IE, as in the name of 
the file to be downloaded appears correctly in the dialog box. I changed 
'application/octet' to 'application/octet-stream' and this had no effect.

Dara
- Original Message -
From: Chris Shiflett <[EMAIL PROTECTED]>
Date: Wed, 29 Jan 2003 06:47:17 -0800 (PST)
To: Dara Dowd <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: Re: [PHP] content type header for downloading files

> --- Dara Dowd <[EMAIL PROTECTED]> wrote:
> > I have the following headers in download.php which forces
> > a download dialog box to be opened when a user clicks on
> > a desired file:
> > 
> > header("Content-type: application/octet");
> > header("Content-Length: $filelength");
> > header("Content-Disposition: attachment;
> > filename=".basename($fname).";");
> > 
> > This works fine with IE, but Mozilla adds a '.php'
> > extension to the filename if i choose the save option,
> > and asks me to choose which application to use if I want
> > to open the file.
> 
> What is the value of $fname? If you are trying to tell it
> the name of your script, then that is why Mozilla names it
> so. The filename directive should be the filename you want
> assigned to whatever you are sending the browser.
> 
> Also, I think you mean to say application/octet-stream, but
> I don't feel like looking it up. I suggest double-checking
> that value.
> 
> Chris

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] content type header for downloading files

2003-01-29 Thread Dara Dowd
how do i examine the headers sent?
- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
Date: Wed, 29 Jan 2003 20:06:47 -0500
To: "''Dara Dowd''" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>, 
<[EMAIL PROTECTED]>
Subject: RE: [PHP] content type header for downloading files 

> > $fname is the name of the file i want to download. It works in IE, as
> in
> > the name of the file to be downloaded appears correctly in the dialog
> box.
> > I changed 'application/octet' to 'application/octet-stream' and this
> had
> > no effect.
> 
> Maybe find a site that works correctly on the browser in question and
> examine the headers it sends?
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php