Skip to content

Instantly share code, notes, and snippets.

@rossriley
Created April 9, 2015 12:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rossriley/bb16ea1b7933292a12a4 to your computer and use it in GitHub Desktop.
Save rossriley/bb16ea1b7933292a12a4 to your computer and use it in GitHub Desktop.
How to adjust upload size by contenttype
$app->initialize();
$app['upload'] = $app->extend('upload', function ($handler, $app) {
if ($app['request']->get('contenttype') == 'pages') {
$handler->addRule('size', ['size' => '100K'], '{label} uploads are limited to {size}', 'Page Image');
}
return $handler;
});
$app->run();
@Jaswinder00
Copy link

Where this code should go in custom extension. Do I also need to change upload size inside PHP ini?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment