1

Topic: restrict file upload to only certain extensions

This code will restrict file upload to only certain extensions.
Open file: system/classes/class_newpost.php

find this (around line 312):

$ext    = '';
add this before:
            $allowedExtensions = array("txt","zip","rar","csv","css","doc","docx","xls","xlsx","rtf","ppt","pptx","pdf","swf","flv","avi","wmv","mov","mkv","jpg","jpeg","gif","png");
            if (!in_array(end(explode(".", strtolower($filename))), $allowedExtensions)) {
                return FALSE;
            }


That's it.
Just change what extensions you want to allow.

Last edited by jinbatsu (2010-10-17 02:49:54)

Thumbs up +5 Thumbs down

2

Re: restrict file upload to only certain extensions

ya jinbatsu. Great Tip. voted for this post.

Install Turnkey Web Scripts start your own profit portals
Do someMicro Jobs and earn decent money on your part time

3

Re: restrict file upload to only certain extensions

How to restrict size of certain extensions?

Thumbs up Thumbs down