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 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

By JeffC - June 20, 2017

Thanks Dave

That's fixed the error message. It is now returning "Error saving 'filename.pdf', file wasn't uploaded properly." as expected.

Thanks, Jeff Shields for the info too.

Jeff