How can I get file content from input field type file

45 views
Skip to first unread message

Lirim Imeri

unread,
Feb 23, 2021, 5:34:38 AM2/23/21
to Joomla! General Development
Hi.
Currently I am developing a payment plugin, and I'm stuck getting file content (.pem file) from a custom field type input I have added in xml file of plugin, visible only in the administrator site.

Mathew Lenning

unread,
Feb 23, 2021, 6:57:41 AM2/23/21
to Joomla! General Development
$input = JFactory::getApplication()->input;
$files = $input->files->get($formControl, array(), 'raw');

Mathew Lenning

unread,
Feb 23, 2021, 6:58:45 AM2/23/21
to Joomla! General Development
Oops. Forgot to say $formControl is jform in most standard components. 

Lirim Imeri

unread,
Feb 23, 2021, 7:15:36 AM2/23/21
to Joomla! General Development
Thanks you so much Mathew.

The method you showed doesn't works in my case, I forgot to mention that this payment plugin is for "Hikashop" comerce, the way this e-comerce works, I think is impossible to access JFactory::getApplication().

venomDev

unread,
Feb 23, 2021, 6:30:11 PM2/23/21
to Joomla! General Development

JFactory is global so you should be able to access it from anywhere. If it's a plugin using namespaces then you could try using \JFactory::getApplication();
Reply all
Reply to author
Forward
0 new messages