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;
fileupload field data should be present
fileupload field data is not present
Joomla 3.8.8
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.
Labels |
Added:
?
|
Category | ⇒ | Fields |
Status | New | ⇒ | Discussion |
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.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-06-13 11:53:30 |
Closed_By | ⇒ | mbabker |
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
I think you have to use
JFactory::getApplication()->input->files->get()
.