UploadForm - Fatal Error Messages

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 4, 2015   (RSS)

By Perchpole - February 4, 2015

Hello, All -

I'm a big fan of the uploadForm available from this site. It's allowed me to provide limited front-end access for users, giving them the chance to upload images and files, etc. without having to negotiate the CMSB back-end.

There are, however, a couple of things I still need to fix. The most important amongst them are 2 show-stopping errors:

1) When someone tries to upload an image that is too big...

Fatal error: Out of memory (allocated 132907008) (tried to allocate 19204 bytes) in /homepages/cmsb/lib/image_functions.php on line 83

2) When someone tries to paste too much text into an info box...

MySQL Error: Data too long for column 'info2' at row 1 - in myFile.php on line 83 by mysql_update()

In both instances is there any way for me to intervene before the script goes bang?

:oS

Perch

By claire - February 4, 2015

Hi Perch

You can error checks on the file upload to stop the script if the file is too large. The relevant PHP function is this: http://php.net/manual/en/function.filesize.php

You can also check the string length of the info2 input and, again, stop the script if it exceeds a certain amount.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/