Examples

Building attachment table (AJAX)

This sample demonstrates how to build your own attachment table. Uploaded files are posted to a handler page over AJAX, then listed with download and remove links — the same pattern a mail composer uses.

Demo code

<?php
    $uploader = new PhpUploader();
    $uploader->MultipleFilesUpload = true;
    $uploader->MaxSizeKB = 10240;
    $uploader->Name = "myuploader";
    $uploader->InsertText = "Select multiple files (Max 10M)";
    $uploader->AllowedFileExtensions = "*.jpg,*.png,*.gif,*.bmp,*.txt,*.zip,*.rar";
    $uploader->Render();
?>

<table id="filelist"></table>
<script type="text/javascript">
function CuteWebUI_AjaxUploader_OnPostback()
{
    // POST the guid list to ajax-attachments-handler.php,
    // then add a row per file returned as JSON
}
</script>
Testing the demo: upload files, then use the download and remove links in the table, or Show files to list what is attached.