×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Input File or File multiple??
Carlos
New Member
Posts: 1
8 năm 11 tháng trước #1143
bởi Carlos
Input File or File multiple?? was created by Carlos
Hi.
When i create a file field type, on table creator.. the final result is a input file multiple...
I edited the XML file in forms folder with the example of joomla documentation ...and nothing
Joomla input file example : docs.joomla.org/File_form_field_type/en
and this is my code...
thanks.
When i create a file field type, on table creator.. the final result is a input file multiple...
I edited the XML file in forms folder with the example of joomla documentation ...and nothing
Joomla input file example : docs.joomla.org/File_form_field_type/en
and this is my code...
<field name="certificate_file_name" type="file" label="COM_TECSIQUIM_CERTIFICATE_FORM_LBL_CERTIFICATE_CERTIFICATE_FILE_NAME" description="COM_TECSIQUIM_CERTIFICATE_FORM_DESC_CERTIFICATE_CERTIFICATE_FILE_NAME" accept="application/pdf" required="true" />
thanks.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Randy Carey
Junior Member
Posts: 23
8 năm 11 tháng trước #1145
bởi Randy Carey
Replied by Randy Carey on topic Input File or File multiple??
Carlos, I suspect you are experiencing the same confusion I had and reported
here
. I eventually realized that the File field type does not react to changes wtihin the XML file - that most attributes listed there reflect the initial settings made in CC but are not used by the php code. My solution was to make the needed changes within the code. Another possible soluiton would be to return to CC, make the changes as you want, then regenerate and install the new code.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Eric Fagault
New Member
Posts: 18
6 năm 7 tháng trước - 6 năm 7 tháng trước #1784
bởi Eric Fagault
Replied by Eric Fagault on topic Input File or File multiple??
Hello,
I do not see post 1 and post 23 of this discussion.
Has your problem been solved?
Because I meet the same difficulty.
I only have to allow the loading of a single file to the user of my component.
I get closer to the doc JOOMLA, but when I change "Filemultiple" by "File" (in the XML file), the name of the image is no longer saved in the table (the field remains empty) and the mage is not saved in the folder.
Best regards.
Eric
I do not see post 1 and post 23 of this discussion.
Has your problem been solved?
Because I meet the same difficulty.
I only have to allow the loading of a single file to the user of my component.
I get closer to the doc JOOMLA, but when I change "Filemultiple" by "File" (in the XML file), the name of the image is no longer saved in the table (the field remains empty) and the mage is not saved in the folder.
Best regards.
Eric
Last edit: 6 năm 7 tháng trước by Eric Fagault.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Tomasci
New Member
Posts: 17
3 năm 9 tháng trước #9820
bởi Tomasci
Replied by Tomasci on topic Input File or File multiple??
Hi.. I'm having the exact same problem. How did you solve this?
Thanks
Thanks
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Tomasci
New Member
Posts: 17
3 năm 9 tháng trước #9821
bởi Tomasci
Replied by Tomasci on topic Input File or File multiple??
Nevermind.. got it!
Here is what I did, in case anyone else needs it:
In /administrator/models/fields/filemultiple I have added the logic to check for "multiple" attribute in xml.
I added private variable "$multiple_files" and checked the xml field for the "multiple" attribute inside the getInput().
This is how that class looks like now:
In XML, you can now add multiple="true" to have multiple files.
If you don't do this, it will be single file.
Cheers
Here is what I did, in case anyone else needs it:
In /administrator/models/fields/filemultiple I have added the logic to check for "multiple" attribute in xml.
I added private variable "$multiple_files" and checked the xml field for the "multiple" attribute inside the getInput().
This is how that class looks like now:
class JFormFieldFileMultiple extends \Joomla\CMS\Form\FormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'file';
private $multiple_files;
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 1.6
*/
protected function getInput()
{
// Multiple files or single file
$this->multiple_files = $this->getAttribute('multiple');
// Build field type
if ($this->multiple_files === "true") :
$html = '<input type="file" name="' . $this->name . '[]" multiple>';
else :
$html = '<input type="file" name="' . $this->name . '[]">';
endif;
return $html;
}
}
In XML, you can now add multiple="true" to have multiple files.
If you don't do this, it will be single file.
Cheers
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Thời gian tải trang: 0.091 giây