Undefined variable error when uploading files

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 20, 2017   (RSS)

By JeffC - June 16, 2017 - edited: June 16, 2017

I have an problem when uploading files. The error is: 

Notice: Undefined variable: encodedFilename in /*/*/*/*/cmsAdmin/lib/upload_functions.php on line 180

The error seems to occur when the file size is too big. A 2.9MB file failed to upload. I reduced the file size and it uploaded successfully.

I have set the maximum upload size to 10240kb in the section editor – so I should have been fine with 2.9MB. Is there another area that the file size needs to be changed?

Thanks

Jeff

By kitsguru - June 16, 2017

your php settings also need to be adjusted - not just CMSB

Jeff Shields

By Dave - June 17, 2017

Hi Jeff, 

Looks like that's a bug with some rarely seen error checking code.

In /lib/upload_functions.php can you try searching for "not chunked" and replace this: 

  // ...not chunked?
  else {
    
    if (!$skipUploadSecurityCheck && !is_uploaded_file($uploadInfo['tmp_name'])) {
      return "Error saving '$encodedFilename', file wasn't uploaded properly.<br/>\n";
    }

With this:

  // ...not chunked?
  else {
    
    if (!$skipUploadSecurityCheck && !is_uploaded_file($uploadInfo['tmp_name'])) {
      return "Error saving '" .htmlencode($uploadInfo['name']). "', file wasn't uploaded properly.<br/>\n";
    }

We'll get this fixed for the next release.  Thanks for the report!

Dave Edis - Senior Developer
interactivetools.com