Reply to Re: Security solution needed for file uploader code

Your name:

Reply:


Posted by Arjen on 10/03/63 11:45

Kerry wrote:
> Hi,
>
> I use the simple PHP script below with an html file for my visitors to
> upload files.
>
> I'd like to make it more secure by either allowing or denying certain files.
> I've tried adding more code but I can't get anything to work.
>
> I'm not an expert, but know it's probably only a couple of simple lines of
> code that will do the trick.

This function checks the extention of $_FILES['uploadfile']['name']
against $allowed[ext]. In my case it's only one extention but you could
also use in_array to check against multuple extensions or rewrite the
func to check multiple files.



function checkext($allowed);
{
$upfile_info = pathinfo($_FILES['uploadfile']['name']);

if (strtolower($upfile_info[extension])==$allowed[extension])
{
return true;
}
else
{
return false;
}
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация