15 posts by 7 authors in: Forums > CMS Builder
Last Post: October 22, 2012   (RSS)

By Jason - October 4, 2012

Hi Djulia,

We've investigated this issue further and found that this is part of a PHP bug, where some .swf files are seen to have a file type of .swc:

https://bugs.php.net/bug.php?id=51700

Here is a work around that will be put into the next release:


*NOTE: ALWAYS make a backup of your files before changing CMS Builder source code*

- Open cmsAdmin/lib/upload_functions.php
- In the saveUpload function (around line 207 in version 2.17), you'll see this line of code:

if ($fileExt == 'swf' && $imageType != IMAGETYPE_SWF) { $isValidFileType = false; }

- replace this line with this:

if (in_array($fileExt, array('swf','swc')) &&
!in_array($imageType, array(IMAGETYPE_SWF, IMAGETYPE_SWC))) { $isValidFileType = false; }


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Upload Feature Error

By Djulia - October 5, 2012

Hi Jason

The file is [font "Verdana"]upload[/#000000]ed, but I always have PHP Notice.

Undefined index: channels in upload_functions.php on line 201

An idea?

Thanks again!

Djulia
Hi Djulia,

I think I can see what is causing the problem. Line 201 tries to get the number of channels that an image has, but an SWF file doesn't have any channels.

If you change line 201 from :

if ($imageData['channels'] == 4) { return sprintf(t("File '%s' isn't valid (CMYK isn't browser-safe)."), htmlspecialchars($uploadInfo['name'])); }

to:

if (@$imageData['channels'] == 4) { return sprintf(t("File '%s' isn't valid (CMYK isn't browser-safe)."), htmlspecialchars($uploadInfo['name'])); }

This should fix the problem. Let me know if it doesn't work.

Thanks

Greg
Greg Thomas
PHP Programmer - interactivetools.com

Re: [greg] Upload Feature Error

By Djulia - October 5, 2012

Hi Greg,

It is perfect! Thanks! :)

Djulia