Forum

Thread tagged as: Error, Addons, Forms

Error in form not working

I'm trying to add error messages to a Perch form, I've adde successfully to all text, email, number fields.

But in the file upload field, the "fileupload" isn't working?

When adding

<perch:error for="cv" type="filetype">
  <span class="error">File must be a PDF or Office document.</span>
</perch:error>

<perch:error for="cv" type="fileupload">
  <span class="error">Couldn't upload the file - could be too big.</span>
</perch:error>

"filetype" works correctly, but when I try to upload a file that's to big. The form just get's reset?

Dan Andersen

Dan Andersen 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which PHP setting are you exceeding?

Drew McLellan said:

Which PHP setting are you exceeding?

From the diagnostics: PHP limits: Max upload 20M, Max POST 10M, Memory: 99M, Total max file upload: 10M

And my php.ini file its set to:

post_max_size = 10M
upload_max_filesize = 20M
Drew McLellan

Drew McLellan 2638 points
Perch Support

How big is the file you're uploading?

I've tried one that's 20,5 mb and one that's 105 mb.

Both of them result in the browser starting to upload the file, then after a while it just resets all fields in the form.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're hitting the post_max_size setting, so the form is never handed to Perch to process. PHP just kills the request.

The post_max_size setting should be larger than the upload_max_filesize setting in normal use.

I've made the following changes, but the same thing happens. It loads for a while before it resets the form.

post_max_size = 30M
upload_max_filesize = 20M
Drew McLellan

Drew McLellan 2638 points
Perch Support

If the form is just resetting then the post isn't getting as far as Perch.

Not sure, it does't show up in the perch admin nor does it show up in my inbox.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That wasn't a question - Perch isn't getting the data so the error can't display. You should look to your hosting settings.

Drew McLellan said:

That wasn't a question - Perch isn't getting the data so the error can't display. You should look to your hosting settings.

Any idea what should I look for?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's really beyond what I'm equipped to help with.