Permalink
Browse files

Updates file input builder in HTMLForm library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 4, 2018
1 parent 2d97127 commit 63fb8820f66875bf43e9c54c1d215e5d2964c5cc
Showing with 10 additions and 9 deletions.
  1. +10 −9 engine/lib/object/HTMLForm.php.inc
@@ -4,7 +4,7 @@
* @details Engine / Object Library
* @file engine/lib/object/HTMLForm.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.1.1
* @version 1.1.2
* @date Creation: Jun 2005
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -582,7 +582,7 @@ class HTMLForm {
global $camyks;
/* build param list */
$params = array('buttons'=>null, 'accept'=>'', 'allowMultiple'=>false);
$params = array('class'=>'', 'buttons'=>null, 'accept'=>'', 'allowMultiple'=>false);
/* check limit */
$this->check_inputsLimit(2);
@@ -601,6 +601,10 @@ class HTMLForm {
/* check object params */
$n = $params['name'].($params['language']?'_'.$params['language']:'');
$params['name'] = $n;
if ($params['allowMultiple'] == true)
$params['name'] .= '[]';
if ($params['default'] === '' and isset($this->object)) {
$params['default'] = isset($this->object->vars[$n])?$this->object->vars[$n]:'';
}
@@ -614,15 +618,12 @@ class HTMLForm {
}
/* build file input element */
$html = '<input type="file" name="'.$n.''.($params['allowMultiple']?'[]" multiple="':'').'"';
if ($this->tabIndex>-1 or $params['tabIndex'] != -1)
$html .= ' '.$this->get_tabIndex(true, $params['tabIndex']);
if ($params['class'] != '')
$html .= ' class="'.$params['class'].'"';
if ($params['onchange'] != '')
$html .= ' onchange="'.$params['onchange'].'"';
$html = '<input type="file"';
$html .= $this->build_inputGenericAttributes($params);
if ($params['accept'] != '')
$html .= ' accept="'.$params['accept'].'"';
if ($params['allowMultiple'] == true)
$html .= ' multiple=""';
$html .= ' /> ';
$html .= '<input type="hidden" name="'.$n.'_deletefile" value="0" />';

0 comments on commit 63fb882

Please sign in to comment.