?
avatar waveywhite
waveywhite
13 Jun 2018

Steps to reproduce the issue

form.xml

<?xml version="1.0" encoding="utf-8"?>
<form>
    <field 
        name="uploads"
        type="subform"
        formsource="path/to/subform.xml"
        label="" 
        description="" 
    />
</form>

subform.xml

<?xml version="1.0" encoding="utf-8"?>
<form>
    <field 
        name="fileupload" 
        type="file" 
        required="true" 
        label="" 
        description="" 
    />
</form>

model.php

$data = JFactory::getApplication()->input->getArray();
echo json_encode($data); exit;

Expected result

fileupload field data should be present

Actual result

fileupload field data is not present

System information (as much as possible)

Joomla 3.8.8

Additional comments

Files are uploading from the browser using multipart form
Files are appearing in the tmp folder
The _FILES global variable has the file information
No file information on Input object.

Workaround is to examine the _FILES global variable directly. The format is a little unusual due to the HTML array syntax of the upload parameters but it's parsable.

avatar waveywhite waveywhite - open - 13 Jun 2018
avatar joomla-cms-bot joomla-cms-bot - change - 13 Jun 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Jun 2018
avatar SharkyKZ
SharkyKZ - comment - 13 Jun 2018

I think you have to use JFactory::getApplication()->input->files->get().

avatar franz-wohlkoenig franz-wohlkoenig - change - 13 Jun 2018
Category Fields
avatar franz-wohlkoenig franz-wohlkoenig - change - 13 Jun 2018
Status New Discussion
avatar mbabker
mbabker - comment - 13 Jun 2018

Correct. JFactory::getApplication()->input on its own is a representation of the $_REQUEST superglobal. To fetch data from a specific global, you need to explicitly add that to your call stack, we don't try to dynamically fetch from any global.

avatar mbabker mbabker - change - 13 Jun 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-06-13 11:53:30
Closed_By mbabker
avatar mbabker mbabker - close - 13 Jun 2018
avatar waveywhite
waveywhite - comment - 13 Jun 2018

After a few hours of trawling around we've worked out how this works now.

For future reference, for when using a Joomla subform you do:

JFactory::getApplication()->input->files->get('jform')

This will provide a nested array of all files organised by subform name, subform row, element name, then details for each element (tmp file name, originating file name, etc).

You can't use input->files->get to get individual files for forms rendered from Joomla XML definitions

Add a Comment

Login with GitHub to post a comment