This enhancement of Uploder, I add a space quota restriction and file extension filtering.
By : wibi
<? /******************************************************************** * file uploader - file uploader code snippet. * maxsize : * - you can set the maxsixe, if file size exceed maxsize it won't proceed; * - you can set the quota, if dir size exceed quota it won't proceed; * - you can set the ext, if file name extension listed on this array it won't proceed; * * Copyright (C) 2001 Wibisono Sastrodiwiryo. * This program is free software licensed under the * GNU General Public License (GPL). * * CyberGL => Application Service Provider * http://www.cybergl.co.id * office@cybergl.co.id * * $Id: uploader2.php3,v 0.2 2001/07/23 22:3:34 wibi Exp $ *********************************************************************/ $dir ="/www/servers/upload"; # your uploaded file dir, this dir require proper permission to write access $temp ="/tmp"; # unix system temp dir $maxsize ="40960"; # max 40 Kb $quota = 524288; # define space quota 500 Kb $ext = array(".p", ".php", ".php3", ".phtml", ".shtml"); # define file extension to reject
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.