HTTP ERROR 500 on fileupload elements

leblancphil

Member
Hello
All my fileupload elements are giving HTTP ERROR 500 without changing anything but they worked before.
I didnt find answer to that, tried every setup.
Thanks for your help
 
"without changing anything" is a miracle;)

Any Joomla or Fabrik updates?
Server updates (php version, mod-security...)?
Is the error in front- and backend?
Joomla's error reporting set to max?
 
ok thanks I forgot using "Joomla's error reporting "
I have this error
Joomla's error reporting : Fatal error: Class 'Fabrik\Helpers\Uploader' not found in /home/mysite/www/plugins/fabrik_element/fileupload/fileupload.php on line 1948
 
I'd suggest doing a full github update, and make sure the file ...

libraries/fabrik/fabrik/Helpers/Uploader.php

... is there.

-- hugh
 
IS there
<?php
/**
* Fabrik upload helper
*
* @package Joomla
* @subpackage Fabrik
* @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
/**
* Fabrik upload helper
*
* @package Joomla
* @subpackage Fabrik
* @since 3.0
*/
class FabrikUploader extends JObject
{
/**
* Form model
*
* @var object
*/
protected $form = null;
/**
* Move uploaded file error
*
* @var bool
*/
public $moveError = false;
/**
* Upload
*
* @param object $formModel form model
*/
public function __construct($formModel)
{
$this->form = $formModel;
}
/**
* Perform upload of files
*
* @return bool true if error occurred
*/
public function upload()
{
$groups = $this->form->getGroupsHiarachy();
foreach ($groups as $groupModel)
{
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel)
{
if ($elementModel->isUpload())
{
$elementModel->processUpload();
}
}
}
}
/**
* Moves a file from one location to another
*
* @param string $pathFrom File to move
* @param string $pathTo Location to move file to
* @param bool $overwrite Should we overwrite existing files
*
* @deprecated (don't think its used)
*
* @return bool do we overwrite any existing files found at pathTo?
*/
public function move($pathFrom, $pathTo, $overwrite = true)
{
if (file_exists($pathTo))
{
if ($overwrite)
{
unlink($pathTo);
$ok = rename($pathFrom, $pathTo);
}
else
{
$ok = false;
}
}
else
{
$ok = rename($pathFrom, $pathTo);
}
return $ok;
}
/**
* Make a recursive folder structure
*
* @param string $folderPath Path to folder - e.g. /images/stories
* @param hex $mode Folder permissions
*
* @return void
*/
public function _makeRecursiveFolders($folderPath, $mode = 0755)
{
if (!JFolder::exists($folderPath))
{
if (!JFolder::create($folderPath, $mode))
{
throw new RuntimeException("Could not make dir $folderPath ");
}
}
}
/**
* Iterates through $_FILE data to see if any files have been uploaded
*
* @deprecated (don't see it being used)
*
* @return bool true if files uploaded
*/
public function check()
{
if (isset($_FILES) and !empty($_FILES))
{
foreach ($_FILES as $f)
{
if ($f['name'] != '')
{
return true;
}
}
}
return false;
}
/**
* Checks if the file can be uploaded
*
* @param array $file File information
* @param string &$err An error message to be returned
* @param JParams &$params Params
*
* @return bool
*/
public static function canUpload($file, &$err, &$params)
{
if (empty($file['name']))
{
$err = 'Please input a file for upload';
return false;
}
if (!is_uploaded_file($file['tmp_name']))
{
// Handle potential malicious attack
$err = FText::_('File has not been uploaded');
return false;
}
jimport('joomla.filesystem.file');
$format = JString::strtolower(JFile::getExt($file['name']));
$allowable = explode(',', JString::strtolower($params->get('ul_file_types')));
$format = FabrikString::ltrimword($format, '.');
$format2 = ".$format";
if (!in_array($format, $allowable) && !in_array($format2, $allowable))
{
$err = 'WARNFILETYPE';
return false;
}
$maxSize = (int) $params->get('upload_maxsize', 0);
if ($maxSize > 0 && (int) $file['size'] > $maxSize)
{
$err = 'WARNFILETOOLARGE';
return false;
}
$ignored = array();
$user = JFactory::getUser();
$imginfo = null;
if ($params->get('restrict_uploads', 1))
{
$images = explode(',', $params->get('image_extensions'));
if (in_array($format, $images))
{
// If its an image run it through getimagesize
if (($imginfo = getimagesize($file['tmp_name'])) === false)
{
$err = 'WARNINVALIDIMG';
return false;
}
}
elseif (!in_array($format, $ignored))
{
// If its not an image...and we're not ignoring it
}
}
$xss_check = file_get_contents($file['tmp_name'], false, null, 0, 256);
$html_tags = array('abbr', 'acronym', 'address', 'applet', 'area', 'audioscope', 'base', 'basefont', 'bdo', 'bgsound', 'big', 'blackface',
'blink', 'blockquote', 'body', 'bq', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'custom', 'dd',
'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'fn', 'font', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4',
'h5', 'h6', 'head', 'hr', 'html', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'keygen', 'kbd', 'label', 'layer', 'legend',
'li', 'limittext', 'link', 'listing', 'map', 'marquee', 'menu', 'meta', 'multicol', 'nobr', 'noembed', 'noframes', 'noscript',
'nosmartquotes', 'object', 'ol', 'optgroup', 'option', 'param', 'plaintext', 'pre', 'rt', 'ruby', 's', 'samp', 'script', 'select',
'server', 'shadow', 'sidebar', 'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea',
'tfoot', 'th', 'thead', 'title', 'tr', 'tt', 'ul', 'var', 'wbr', 'xml', 'xmp', '!DOCTYPE', '!--');
foreach ($html_tags as $tag)
{
// A tag is '<tagname ', so we need to add < and a space or '<tagname>'
if (JString::stristr($xss_check, '<' . $tag . ' ') || JString::stristr($xss_check, '<' . $tag . '>'))
{
$err = 'WARNIEXSS';
return false;
}
}
return true;
}
/**
* Recursive file name incrementation until no file with existing name
* exists
*
* @param string $origFileName Initial file name
* @param string $newFileName This recursions file name
* @param int $version File version
*
* @return string New file name
*/
public static function incrementFileName($origFileName, $newFileName, $version)
{
if (JFile::exists($newFileName))
{
$bits = explode('.', $newFileName);
$ext = array_pop($bits);
$f = implode('.', $bits);
$f = JString::rtrim($f, $version - 1);
$newFileName = $f . $version . "." . $ext;
$version++;
$newFileName = self::incrementFileName($origFileName, $newFileName, $version);
}
return $newFileName;
}
}
 
I have done and now, I got this error message Fatal error: Class 'Joomla\CMS\Helper\MediaHelper' not found in /home/mysite/www/plugins/fabrik_element/field/field.php on line 256
 
so I commented that part of field.php
Code:
/*
            if ((new MediaHelper)->isImage($value))
            {
                $alt = empty($title) ? '' : 'alt="' . strip_tags($w->parseMessageForPlaceHolder($title, $data)) . '"';
                $value = '<img src="' . $value . '" ' . $alt . ' ' . implode(' ', $attrs) . ' />';
            }
            else
            {
                if (FabrikWorker::isEmail($value) || JString::stristr($value, 'http'))
                {
                }
                elseif (JString::stristr($value, 'www.'))
                {
                    $value = 'http://' . $value;
                }
                if ($title !== '')
                {
                    $opts['title'] = strip_tags($w->parseMessageForPlaceHolder($title, $data));
                }
                $label = FArrayHelper::getValue($opts, 'title', '') !== '' ? $opts['title'] : $value;
                $value = FabrikHelperHTML::a($value, $label, $opts);
            }
            */
and it works, so I can upload files again.
 
another error on sending mail
Fatal error: Class 'Joomla\CMS\Profiler\Profiler' not found in /home/mysite/www/plugins/fabrik_form/email/email.php on line 76

So I commented email.php line 76 and it works
 
Last edited:
Joomla! 3.7.5 Stable [ Amani ] 14-August-2017 12:09 GMT
Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
 
That's very bizarre. MediaHelper and Profiler should definitely exist in that version, and you'll notice that nobody else is reporting issues with those class names. Check your ./libraries/classmap.php, part of the J! core, which should include references to both those, at line 319 ...

JLoader::registerAlias('JHelperMedia', '\\Joomla\\CMS\\Helper\\MediaHelper', '5.0');

... and line 271 ...

JLoader::registerAlias('JProfiler', '\\Joomla\\CMS\\Profiler\\Profiler', '5.0');

-- hugh
 
We are in need of some funding.
More details.

Thank you.
Back
Top