FilePicker

This control makes selecting files from the locale hard drive easy. It can automatically transfer selected files to a server, report progress, and even display image previews.

Basic example
var loading = Fit.Dom.CreateElement("Uploading..");
var up = new Fit.Controls.FilePicker("Upload");
up.Url("http://server.com/ReceiveFile.php");
up.AutoPostBack(true);
up.MultiSelectionMode(true);
up.OnUpload(function(sender)
{
    up.Enabled(false);
    Fit.Dom.InsertAfter(up.GetDomElement(), loading);
});
up.OnCompleted(function(sender)
{
    up.Enabled(true);
    setTimeout(function() { Fit.Dom.Remove(loading); }, 500);
    alert("All files processed");
});
up.Render(document.body);

Receiving files
Each selected file is automatically sent to the server via POST using individual HTTP requests, and is made available server side using the SelectedFile key. The code below demonstrates how to save received files using PHP.
if (!isset($_FILES["SelectedFile"]))
    exit;

if ($_FILES["SelectedFile"]["error"] !== 0)
    echo "Error";

$result = move_uploaded_file($_FILES["SelectedFile"]["tmp_name"], "UploadFolder");

if ($result === true)
    echo "OK";
else
    echo "Error";
Fit.UI is open source (LGPL) - download or fork it on GitHub - website powered by Sitemagic CMS