1: <?php
2: /**
3: * XOOPS form element
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright (c) 2000-2017 XOOPS Project (www.xoops.org)
13: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
14: * @package kernel
15: * @subpackage form
16: * @since 2.0.0
17: * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/
18: */
19:
20: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
21:
22: /**
23: * A file upload field
24: */
25: class XoopsFormFile extends XoopsFormElement
26: {
27: /**
28: * Maximum size for an uploaded file
29: *
30: * @var int
31: * @access private
32: */
33: public $_maxFileSize;
34:
35: /**
36: * Constructor
37: *
38: * @param string $caption Caption
39: * @param string $name "name" attribute
40: * @param int $maxfilesize Maximum size for an uploaded file
41: */
42: public function __construct($caption, $name, $maxfilesize)
43: {
44: $this->setCaption($caption);
45: $this->setName($name);
46: $this->_maxFileSize = (int)$maxfilesize;
47: }
48:
49: /**
50: * Get the maximum filesize
51: *
52: * @return int
53: */
54: public function getMaxFileSize()
55: {
56: return $this->_maxFileSize;
57: }
58:
59: /**
60: * prepare HTML for output
61: *
62: * @return string HTML
63: */
64: public function render()
65: {
66: return XoopsFormRenderer::getInstance()->get()->renderFormFile($this);
67: }
68: }
69: