Re: BBS style download/upload system
| From: | Richard Lynch | Date: | Wed, 27 Dec 2000 03:59:20 +0000 |
| Subject: | Re: BBS style download/upload system | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31911@lists.php.net to get a copy of this message | ||
The download is fairly easy -- Just send header("Content-type:
application/octet-stream") and some other headers you can dig out of one of
the code archives linked from http://php.net/links.php
Search for "octet"
Upload gets a lot tougher. Even with "trusted" users, there's always the
risk of infected files, malicious files, executables etc. Files get
uploaded by default to /tmp, since that is usually world-writable. You
should then apply every filter you can to be sure the file is not
problematic. Then, and only then, you can use copy() to move the file from
/tmp to your download directory.
You may also wish to log who uploaded what, just in case.
----- Original Message -----
From: "Nando2" <nando@antunes.eti.br>
Newsgroups: php.general
Sent: Tuesday, December 26, 2000 10:51 AM
Subject: [PHP] BBS style download/upload system
Hello everyone.
I need to have a donwload script for authorized users only. I'm aware on how
to do a login system with sessions but I need to know how to enable the
users (once they are properly authorized) download files from the system.
This files are only intended for authorized employes. Most of them consist
of MS word, Excel and ZIP files.
I want to stored them on a separate directory (other than the web tree) and
use fread or any better sugestion to transfer the files from the system to
the client.
Also, I need to have a way to upload files to the system and have them
stored on a diferent directory as well.
I kind of curious if it is safer to do it through http or ftp. If it is
through ftp I'm considering hiding the user name and password from the users
and have just one username password for the ftp server. If it is through
http I believe that would make things easier.
Can anyone help me do that ?
I need to :
- Have a script to donwload files from the my Linux server using HTTP.
- Have a script to upload files through http as well.
Does anyone found a script to do such thing on the net or any Linux / PHP
magazine or publication?
Thank you,
Carlos Fernando Scheidecker Antunes.