PHP code example of flsouto / htupload

1. Go to this page and download the library: Download flsouto/htupload library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flsouto / htupload example snippets




$up = new HtUpload("attachment",$savedir=__DIR__);
$up->label($label="Choose a file");
// echo $up to output the widget




$up = new HtUpload("attachment",__DIR__);
$up->label(['text'=>'Choose a file','selected'=>'Attachment: %s']);
$result = $up->process(); // $result->output contains filename




$up = new HtUpload("attachment",__DIR__);
$up->accept(['application/pdf','application/doc'],'Only pdf/doc is allowed!');
$result = $up->process(); // result->error contains error message




$up = new HtUpload("attachment",__DIR__);
$up->rror message