| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Suppress "error - 0 - No summary was found for this file" on phpdoc generation |
| 5 |
* |
| 6 |
* @package WPDataAccess\Simple_Form |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace WPDataAccess\Simple_Form { |
| 10 |
|
| 11 |
/** |
| 12 |
* Class WPDA_Simple_Form_Item_File |
| 13 |
* |
| 14 |
* Database column is handled files |
| 15 |
* |
| 16 |
* @author Peter Schulz |
| 17 |
* @since 5.1.3 |
| 18 |
*/ |
| 19 |
class WPDA_Simple_Form_Item_File extends WPDA_Simple_Form_Item { |
| 20 |
|
| 21 |
/** |
| 22 |
* WPDA_Simple_Form_Item_File constructor. |
| 23 |
* |
| 24 |
* @param array $args |
| 25 |
*/ |
| 26 |
public function __construct( $args = array() ) { |
| 27 |
parent::__construct( $args ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Overwrite method |
| 32 |
* |
| 33 |
* @param string $action |
| 34 |
* @param string $update_keys_allowed |
| 35 |
*/ |
| 36 |
public function show( $action, $update_keys_allowed ) { |
| 37 |
parent::show( $action, $update_keys_allowed ); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Overwrite method |
| 42 |
*/ |
| 43 |
protected function show_item() { |
| 44 |
if ( isset( $_FILES[ $this->item_name ] ) && '' !== $_FILES[ $this->item_name ]['name'] ) { |
| 45 |
// Process uploaded file. |
| 46 |
// TODO |
| 47 |
// var_dump($_FILES[ $this->item_name ]); |
| 48 |
} |
| 49 |
?> |
| 50 |
<label> |
| 51 |
Select file to upload |
| 52 |
</label> |
| 53 |
<input type="file" name="<?php echo esc_attr( $this->item_name ); ?>" id="<?php echo esc_attr( $this->item_name ); ?>"> |
| 54 |
<?php |
| 55 |
} |
| 56 |
|
| 57 |
} |
| 58 |
|
| 59 |
} |
| 60 |
|