[API] Make configurable file size, max size and max number of files for /files endpoint #976

Closed
batopa opened this Issue Sep 14, 2016 · 2 comments

Projects

None yet

2 participants

@batopa
Member
batopa commented Sep 14, 2016 edited

We should permit to configure some parameters to use when uploading a file through /files endpoint.

  • maxFileSize i.e. the max dimension that a single file can have
  • maxSizeAvailable i.e. the max size availaible for every user (all files)
  • maxFilesAllowed i.e. the max number of file that every user can upload
$config['api']['upload'] = array(
    'maxFileSize' => 8388608, // 8 MB
    'maxSizeAvailable' => 83886080, // 80 MB
    'maxFilesAllowed' => 100
);

@bedita/core should we have some default values if some configuration missing?

Furthermore we have already implemented a mime type check using $config['validate_resource']['mime'] of BEdita core config.
We could introduce an alias mimeTypes of it in $config['api']['upload'] and fallback to $config['validate_resource']['mime'] if $config['api']['upload']['mimeTypes] is not defined.
In this way we'll have all upload configuration grouped.

@batopa batopa added this to the 3-updates milestone Sep 14, 2016
@batopa batopa self-assigned this Sep 14, 2016
@stefanorosanelli
Member

Yes, probably some high default max values are a good idea

@batopa
Member
batopa commented Sep 14, 2016

And... should be better to explicit conf per object types?
For example:

$config['api']['upload'] = array(
    'maxFileSize' => array('image' => 8388608, 'video' => 22222222)
    'maxSizeAvailable' => array('image' => 83886080, 'video' => 99999999999)
    'maxFilesAllowed' => array('image' =>100, 'video' => 30)
);

where the total is the sum of all object types conf. If some value for object type missing use default.

This introduce more control and more complexity.

@batopa batopa added a commit that referenced this issue Sep 15, 2016
@batopa batopa #976 feat: add "Api.beforeCheckUpload" event
To permits listener to give information about the user quota used
894fcbb
@batopa batopa added a commit that referenced this issue Sep 15, 2016
@batopa batopa #976 chore: typo
mantra: bato go home, bato go home
59c52ce
@batopa batopa added a commit that referenced this issue Sep 20, 2016
@batopa batopa #976 refactor: move checking quota to ApiUpload and rename event
Rename 'Api.beforeCheckUpload' event to 'Api.uploadQuota'
634e692
@batopa batopa added a commit to bedita/docs that referenced this issue Sep 27, 2016
@batopa batopa bedita/bedita#976 chore: upload configuration 3db6ce9
@batopa batopa added a commit to bedita/docs that referenced this issue Sep 27, 2016
@batopa batopa bedita/bedita#976 feat: add error code section 4efae1c
@batopa batopa closed this Sep 27, 2016
@batopa batopa added a commit to bedita/docs that referenced this issue Sep 28, 2016
@batopa batopa bedita/bedita#976 chore: improve configuration page c843f23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment