Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Limit the number of files that can be loaded and the file type to only allow images in FileUpload

GW_GW_
edited March 2012 in Vanilla 2.0 - 2.8

How to limit the number of files that can be loaded and the file type to only allow images using FileUpload?

I want to use File Upload to upload a picture for each discussion and show the pictures in the Discussions Board.

Wich one is the best way to do that?

Tagged:

Answers

  • ToddTodd Vanilla Staff

    We don't currently have a way to limit the number of files, but you can limit the file extensions with the following config:

    $Configuration['Garden']['Upload']['AllowedFileExtensions'] = array('jpg','jpeg','gif','png');
    
  • which file we need to do this modification?

  • Hi
    After a dig on finding where i can set up the allowed file extensions on fileupload plugin, i´ve realised that the file where we have to set is /conf/config-defaults.php

    Around line 81 $Configuration['Garden']['Upload']['AllowedFileExtensions'] = array('txt','jpg','jpeg','gif','png','bmp','tiff','zip','gz','tar.gz','tgz','psd','ai','fla','swf','pdf','doc','xls','ppt','docx','xlsx','log','rar','7z');

  • HalfCatHalfCat ✭✭
    edited November 2012

    @wilsoncortez: no, never edit the config-defaults.php, instead edit the /conf/config.php as also specified in the readme file in that folder.

  • no, never edit the config-defaults.php, instead edit the /conf/config.php as also specified in the readme file in that folder.

    Oops, sorry. I´ve read it now. But HalfCat this line mentioned by Todd isn´t on that file. Do I need to insert it in order to get control of extensions?

    Second sorry if someone got my misleading comments :-(

    Thank You HalfCat and if some MOD wants to delete my original post in order to get things right, please go on

  • @HalfCat forget to ask one ;)

    Does the the "/conf/config.php" override the config-defaults.php?

    Thanks

  • Yes. If it isn't there, just add it.

  • edited November 2012

    @HalfCat Thank you HalfCat :)

Sign In or Register to comment.