Reply to Re: uploading php scripts

Your name:

Reply:


Posted by J.O. Aho on 10/07/64 11:37

Gernot Frisch wrote:

> how can I prevent someone uploading a php script e.g? I want them to
> be able to upload .exe/.zip and images.

You will need to make a check on the extension when the file is uploaded, if
it's something else than .exe/.zip, just delete the file.

/* we assume <input name="uploadFile" type="file"> */
$filename=$_FILES['uploadFile'];
$accepted_endings=array("zip","exe");

if(in_array(substr($filename, -3, 3),$accepted_endings)) {
/* code for accepting and storing the file */

} else {
/* code for deleting the file and give a bad bad message */

}


//Aho

[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

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