Frontend file / image upload doesn't work

More
3 months 2 weeks ago - 3 months 2 weeks ago #85284 by mcmurdok
If I use an upload field for images or files from frontend.
The upload script calls an URL like that:
http://bug/index.php?option=com_flexicontent&task=filemanager.uploads&ff82baa73811e4d0a57ee96b9aff0fb1=1&fieldid=19&u_item_id=1021
and I get an 403 error with the following information: 

Direct usage of this controller is not allowed in frontend. Task: uploads
/Users/mb/Sites/tblbug/administrator/components/com_flexicontent/controllers/items.php:70

Code:
1 () JROOT/administrator/components/com_flexicontent/controllers/items.php:70 2 FlexicontentControllerItems->__construct() JROOT/libraries/src/MVC/Controller/BaseController.php:342 3 Joomla\CMS\MVC\Controller\BaseController::getInstance() JROOT/components/com_flexicontent/flexicontent.php:264 4 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71 5 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73 6 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361 7 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:208 8 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:249 9 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293 10 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:61 11 require_once()JROOT/index.php:32

It seems that something breaks the correct routing to filemanager. I don't know what changed. It appeared suddenly.
The only thing I tested is, that if I use another older version of the database before the error appeared, it works.

What configuration could do that? With the old db-version I get a correct JSON answer like:
Code:
{"jsonrpc" : "2.0", "error" : {"code": status, "message": "Filename has invalid characters (or other error occured)"}, "data" : null}
I've condensed the entire installation to the essentials, joomla and flexicontent only. Any redirect?

Regards

Joomla 4.4.4 / FC 4.2.1
Last edit: 3 months 2 weeks ago by mcmurdok. Reason: formatting

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #85285 by micker
hello an issue is open here
github.com/FLEXIcontent/flexicontent-cck/issues/1199
you can test beta version here

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #85286 by mcmurdok
Hi micker,
after hours of debugging, we found the cause of our problem with the upload from the frontend. Maybe this is also the solution for github.com/FLEXIcontent/flexicontent-cck/issues/1199.
Since we had an old, working version of the database and a no longer functioning version of the database, the cause had to be an interim misconfiguration of the system.

Both versions called the upload URL e.g. /index.php?option=com_flexicontent&task=filemanager.uploads&ff82baa73811e4d0a57ee96b9aff0fb1=1&fieldid=19&u_item_id=1021.
The working version correctly routed to the filemanager controller, while the other returned a 403 error in the administrator - items controller.

Since the 'view' was not explicitly passed as a parameter in this URL, the upload scripts automatically added the parameter 'view' with a default value.
The working version used the view "category", while the non-working version used the view "item".The reason for the different determination of the value for the 'view' parameter lies in how JInput attempts to ascertain the missing value. Ultimately, JInput took the value for 'view' from the content associated with the Home menu item. In our case, this had meanwhile changed from a Flexicontent category page to a Flexicontent item page.

By reassigning a Flexicontent category page as the homepage, the upload worked again.

If a single Flexicontent page is used as the homepage, the frontend upload does not work again.
In this case, explicitly passing the 'view' parameter with the value 'category' in the file com_flexicontent/helpers/html/fcuploader.php (line 98:99) helps.
change from
Code:
'action' => JUri::base(true) . '/index.php?option=com_flexicontent&task=filemanager.uploads'                 . '&'.JSession::getFormToken().'=1' . '&fieldid='.($field ? $field->id : ''). '&u_item_id='.$u_item_id,
to
Code:
'action' => JUri::base(true) . '/index.php?option=com_flexicontent&task=filemanager.uploads&view=category'                . '&'.JSession::getFormToken().'=1' . '&fieldid='.($field ? $field->id : ''). '&u_item_id='.$u_item_id,

Final questions: Why don't the other 'view' options work, and what happens if a different component is used as the homepage?

Regards
McMurdok

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #85287 by mcmurdok
I believe the issue github.com/FLEXIcontent/flexicontent-cck/issues/1199 is different from my problem/bug

Please Log in or Create an account to join the conversation.

More
3 months 1 week ago #85288 by micker
what is your flexicontent and joomla version ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
3 months 1 week ago #85289 by mcmurdok
Joomla 4.4.4
Flexicontent 4.2.1
PHP 8.2

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.298 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline