We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem, Configuration

Trying to prevent file uploads above a certain size

I'm trying to prevent a client uploading large images.

I've adjusted the php_ini file and the settings are now showing in the Perch diagnostics as follows:

GD: Yes ImageMagick: No PHP max upload size: 1M PHP max form post size: 2M PHP memory limit: 128M Total max uploadable file size: 1M Resource folder writeable: Yes

However, I am still able to upload image files up to 5Mb successfully. From 5mb to 10mb it looks like it's uploading OK but doesn't (presumably starting but not finishing). Above 10Mb I get an actual error message:

"The page at www.xyz.com says: Error: File too large: <filename>". this would actually be ideal if it happened at 1Mb not 10 Mb.

I've spent the best part of the day trying to resolve this with my service provider. I finally got them to manage to replicate the issue and they think it's perplexing and could I ask my Perch support. I cant really see how it's anything to do with Perch but just on the off chance, I'm posting here.

Any ideas anyone?

Cheers - Mark

mark buckley

mark buckley 0 points

  • 6 years ago

Should have said 'php.ini' of course.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where are you uploading? The Gallery app uploader chunks uploads into 1MB chunks.

Aha, well that explains a lot.

What's the simplest way then to prevent my client keep uploading large files using the gallery app?

Drew McLellan

Drew McLellan 2638 points
Perch Support

In Settings, switch to using the basic uploader.

Well, that seems to do the trick. However I of course lose all the nice functionality of the non-basic uploader.

What if I set the upload limit to 0.99M or more practically 0.95M, Would that do the trick do you think?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I couldn't say without trying it. I'm not sure if that's a valid value for that option.

Well,, it seems to work a treat. You still get the left-overs (alt text) that you get with any failed image upload but it seems to do what I need it to do.

0.95M isn't valid, you were correct. You can specify 950K or by default the integer is treated as bytes if no size abbreviation is given.

I'm going to mark the most recent as the 'Solution'.

Thanks for all your help.

Cheers - Mark