Restrict max file size upload- Instacks Repo

Hi, I’m installing a gallery for a client powered by Repo at @Jannis

I know this client is going to attempt to upload images directly from an iPhone, so I need to restrict the max file size Repo can handle.

Possible?

If not, any other way to do this?

The site sits on my VPS and I can’t restrict file size via Cpanel, as I think this will affect the entire server?

Yes, with changing the max upload file size in the PHP settings.
You will unfortunately not get a nice error message, though.

Repo does not shrink the images currently. Already noted for a 2.0 version.

Can the max file size be set per folder though? I thought it was for the entire server?

Unsure about that. I think it’s a server/domain wide setting.

That’s my understanding to, I need to restrict the file size for just one folder.

Anyone know how?

I don’t have any personal experience with this but I would think that it would work the same way as htaccess files (where it takes the ‘global’ file, unless something further down the file structure overrides it). So, if you were to replicate the php.ini file and just change the max upload size?

That’s all speculation though…

Edit: https://stackoverflow.com/questions/2899326/overwrite-php-ini-settings The couple of (super old) links in here suggest you can either do as I stated above or set a rule in htaccess (the latter seems the cleaner way to do it).

1 Like

Interesting.

A bit more Googling turns up the advice to put this line into the htaccess file in the folder to limit…

php_value upload_max_filesize xxM

But doing so, and changing the “xx” to 1, kills Repo. @Jannis any ideas?

No idea.

Make sure that the php is being applied, also 1 megabyte is pretty small.
Create a PHP test file that contains the following code in the same directory where the .htaccess file is located:

<?php phpinfo(); ?>

Then look for two variables in the info that returns:

upload_max_filesize
post_max_size

post_max_size needs to be larger than upload_max_filesize. It can be set in htaccess as well.

php_value post_max_size xxM
1 Like