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.
Options

Avatar FileSize exception

edited June 2012 in Vanilla 2.0 - 2.8

\forum\applications\dashboard\controllers\class.profilecontroller.php

       /**
        * Set user's photo (avatar).
        *
        * @since 2.0.0
        * @access public
        * @param mixed $UserReference Unique identifier, possible username or ID.
        * @param string $Username.
        */
       public function Picture($UserReference = '', $Username = '') {
           ...
           $Upload = new Gdn_UploadImage();
           ...

How can I know file size of the uploaded avatar for error handling?

Answers

  • Options

    I think it can be controlled from /conf/config.php

  • Options

    I have an upload SIZE limit in php.ini

    and when user EXCEEDS it - no error notification is showed

    just a white form with black text on the page for newer upload...

    terrible feature.

  • Options

    like acoda said you can set

    $Configuration['Garden']['Upload']['MaxFileSize'] = '50M';

    5OM is very high. 1M is high IMO, if they want more than that then they can use a file host.

    grep is your friend.

  • Options

    5OM is very high. 1M is high IMO, if they want more than that then they can use a file host.

    Thank you very much.

    But how can I have my low limit of 150Kb in php.ini and conf

    and catch the error?

  • Options
    edited June 2012

    Btw even cought error like inappropriate file extension causes redirect to "unpacked" not-popup "dialog".

    Here must be a popup

    image

    and this picture when uploaded file exceedes php.ini upload limit

    image

  • Options
    peregrineperegrine MVP
    edited June 2012

    it should already be there - just change the error message. classuploadimage.php

         // Now perform image-specific checks
          $Size = getimagesize($TmpFileName);
          if ($Size === FALSE)
             throw new Exception(T('The uploaded file was not an image.'));
    
          return $TmpFileName;
    

    change this in your definitions file to reflect the size.

    The uploaded file was not an image

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

  • Options
    edited June 2012

    Well, I've edited php.ini to 50M

    I have no "white screen error" now. No popup nonetheless.

    @peregrine, the error is in the class.upload.php.

    For example FileUpload Plugin can handle with both limits - and in php.ini and in conf.

Sign In or Register to comment.