Skip to content

Commit

Permalink
1.0.4: Corrected support for maxSize property
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Dec 7, 2019
1 parent b3238af commit 3edebb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
28 changes: 14 additions & 14 deletions traits/ComponentUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,18 @@ protected function processFileTypes($includeDot = false)

return implode(',', $types);
}

/**
* Get the max File Size
*
* @return int
*/
protected function getMaxFileSize(){
if ($maxSize = $this->property('maxSize')) {
return round($maxSize * 1024);
} else {
return File::getMaxFilesize();
}
}

/**
* Get the max File Size
* @return int
*/
protected function getMaxFileSize()
{
if ($maxSize = $this->property('maxSize')) {
return round($maxSize * 1024);
}
else {
return File::getMaxFilesize();
}
}
}
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1.0.1: First version of Uploader
1.0.2: Added JavaScript events for change, upload success and remove upload
1.0.3: Fix multiple uploads occuring in newer builds
1.0.4: Corrected support for maxSize property

3 comments on commit 3edebb3

@Denoder
Copy link
Contributor

@Denoder Denoder commented on 3edebb3 Dec 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this calculated in bytes?
If yes i can also add the filesize function within uploader.js

I'm trying to get sortable working also, but running into issue removing the dependency for oc.foundation

@daftspunk
Copy link
Member Author

@daftspunk daftspunk commented on 3edebb3 Dec 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the maxSize is MB

            'maxSize' => [
                'title'       => 'Max file size (MB)',
                'description' => 'The maximum file size that can be uploaded in megabytes.',
                'default'     => '5',
                'type'        => 'string',
            ],

Perhaps that should be divide by 1024 instead? nvm.. the code is right

@Denoder
Copy link
Contributor

@Denoder Denoder commented on 3edebb3 Dec 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea

Please sign in to comment.