flsouto / htupload
关于此包最新版本(1.0.2)的许可信息不可用。
flsouto/htform 的插件小部件,允许文件上传。
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: 2024-09-19 11:47:24 UTC
README
flsouto/htform 的插件,允许文件上传。
用法
创建和渲染
<?php $up = new HtUpload("attachment",$savedir=__DIR__); $up->label($label="Choose a file"); // echo $up to output the widget
处理提交
<?php $up = new HtUpload("attachment",__DIR__); $up->label(['text'=>'Choose a file','selected'=>'Attachment: %s']); $result = $up->process(); // $result->output contains filename
添加验证
<?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