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.

Restricting upload size for FileUpload Plugin

edited April 2012 in Vanilla 2.0 - 2.8

Is there a way to restrict the size of images and uploads to my forum?

Answers

  • CaioCaio
    edited April 2012

    With some code, yes. Will probably be Javascript.

  • peregrineperegrine MVP
    edited April 2012

    I haven't looked at the plugin that you didn't mention the name of :) , I would assume there is a settings size. Just as the uploading of a users photo has a size restriction.

    if you are designing something yourself.

    fileupload tutorial

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited April 2012

    Sorry total oversight on my behalf I just amended my post accordingly. The Plugin is FileUpload.

    Thanks for pointing that out to me.

    Cheers Michael

  • 422422 Developer MVP

    Isnt it set in config

    There was an error rendering this rich post.

  • Clicking the plugin setting brings me to the media tab under Forum. Inside there there is only the option to either turn file Upload On or Off or define who can upload and manges files.

  • I tried that but that only restricts the pixel size not how large the file you can upload.

  • peregrineperegrine MVP
    edited April 2012
    it looks like it takes the smallest of the three of these
            $PostMaxSize = Gdn_Upload::UnformatFileSize(ini_get('post_max_size'));
            $FileMaxSize = Gdn_Upload::UnformatFileSize(ini_get('upload_max_filesize'));
            $ConfigMaxSize = Gdn_Upload::UnformatFileSize(C('Garden.Upload.MaxFileSize', '1MB'));
    
    
        two set by php and the last set in config.php
    
        This would probably limit maxsize to 2mb. probabably 500KB for 500KB
    
        $Configuration['Garden']['Upload']['MaxFileSize'] = 2MB;
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Where did you go to find that code? And what would I type to limit the file size to 1mb?

  • peregrineperegrine MVP
    edited April 2012
    looks like the default is already 1Mb
    look around line 200
    class.fileupload.plugin.php
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Maybe but I just uploaded an image that was 2.5mbs

  • add the config line and see what it does.

    I'm suggesting not testing.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Cool with give it a try. Do you mean this line "$Configuration['Garden']['Upload']['MaxFileSize'] = 2MB;"

    Also where exactly do I add that?

  • peregrineperegrine MVP
    edited April 2012

    Between the lettuce and the tomatoes :)

    you could throw it in at the bottom of the other garden statement that start with

    $Configuration['Garden']

    I think its more of a look then a necessity, keep all types together.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.