View previous topic :: View next topic |
Author |
Message |
Stefan_D -
Joined: 21 Aug 2006 Posts: 4
|
Posted: Mon Aug 21, 2006 10:12 am Post subject: Block certain file types on PHP upload |
|
|
Hello,
maybe you guys can help me on this problem. I've a section on an internetsite where users can upload files. The directories all have a password and only certain users are allowed to enter the upload section. Everything is working perfect at the moment (users and passwords are created, php.ini has the correct file size limits, etc.) but I have one major problem:
People could possibly upload every file type to these directories (e.g. even .exe. / .php / .html / etc.). How can I block the upload of these file types?? I haven't found an option on the Abyss Webserver (X1) and I'm not really good with PHP. Maybe you can give me a hint - it shouldn't be that difficult - or am I wrong??
If it's not possible to restrict any file types either with the Webserver nor within the PHP script, I've to talk to the Website Programmer, so he can find a solution in his script - although I prefer to find a faster and easier solution (who doesn't). :)
Thanks for your help in advance...
Greetz,
Stefan
PS: The Abyss Webserver ist a great programm and very easy to configure. I really like it a lot. Congratulations!!! |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Aug 21, 2006 11:03 am Post subject: Re: Block certain file types on PHP upload |
|
|
Stefan_D,
Thank you for your comments about Abyss Web Server.
Since the upload is done with a PHP script, the only solution is to check (in the script) the file type once uploaded and decide if you want to keep it or delete it. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Mikor -
Joined: 21 Aug 2006 Posts: 144 Location: Hull, England
|
Posted: Mon Aug 21, 2006 11:38 am Post subject: |
|
|
Code: |
$banned = array('.php','.html');
$block = false;
foreach($banned as item){
if(ereg($item,strtolower($filename)){
$block = true;
}
}
if($block == true){
die('Disallowed File Type');
}else{
//Rest Of The Script Goes Here
} |
To ban a filetype, just add it to the $banned array _________________ Yarrt.com - Free Arcade
RypNet.co.uk - Online Game
MSN: michael_walker_2004 <at> hotmail <dot> com |
|
Back to top |
|
 |
|