Undefined offset: 0 error

14 posts by 2 authors in: Forums > CMS Builder
Last Post: November 9, 2018   (RSS)

By gkornbluth - November 8, 2018

Thanks Daniel,

I'll give it a try.

I thought that might be an internal variable and was afraid to mess with it.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - November 8, 2018

Hi Jerry,

I had a look at the file, and it uses this condition to decide whether or not to process the upload:

...

$uploadFieldName = 'profile_image';
$uploadInfo = @$_FILES[$uploadFieldName];
if ($uploadInfo && !$errorsAndAlerts) {

...

This could potentially be triggering even if there's no file specified for upload, resulting in any uploaded image being deleted. Instead, you can try checking for the "name" key in the upload info:

...

$uploadFieldName = 'profile_image';
$uploadInfo = @$_FILES[$uploadFieldName];
if (!empty($uploadInfo['name']) && !$errorsAndAlerts) {

...

I hope this does the trick! Let me know how it goes.

Thanks,

Daniel
Technical Lead
interactivetools.com

By gkornbluth - November 9, 2018

Hey Daniel,

That seems to have done the trick.

Thank you for all the help and encouragement.

It's really great working with people that have our backs.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php