flsouto / htupload
There is no license information available for the latest version (1.0.2) of this package.
Plugin widget for flsouto/htform which enables file uploads.
1.0.2
2021-01-27 15:13 UTC
Requires
- php: >=5.6.2
- ext-fileinfo: *
- ext-json: *
- flsouto/htwidget: ^1.0
This package is not auto-updated.
Last update: 2025-02-06 13:37:53 UTC
README
Plugin for flsouto/htform which enables file uploads.
Usage
Creating and rendering:
<?php $up = new HtUpload("attachment",$savedir=__DIR__); $up->label($label="Choose a file"); // echo $up to output the widget
Processing the submit:
<?php $up = new HtUpload("attachment",__DIR__); $up->label(['text'=>'Choose a file','selected'=>'Attachment: %s']); $result = $up->process(); // $result->output contains filename
Add validations:
<?php $up = new HtUpload("attachment",__DIR__); $up->accept(['application/pdf','application/doc'],'Only pdf/doc is allowed!'); $result = $up->process(); // result->error contains error message
<?php $up = new HtUpload("attachment",__DIR__); $up->required("It's mandatory to send a file"); $result = $up->process(); // result->error contains error message