File uploading

If you need to allows user file uploads, use fileupload component.

template.html file:

<haq:fileupload id="fu">
    Click here to start file selecting.
</haq:fileupload>

Client.hx file:

class Client extends BaseClient
{
    function fu_select(t, e)
    {
        // here you can test e.fileName
        // and return false to cancel uploading
        // if that file not expected
    }
    
    function fu_uploading(t, e)
    {
        // here upload in process
        // so you can show progress indicator
    }
    
    function fu_complete(t, e)
    {
        for (upload in e.uploads)
        {
            // now you have upload.fileID
            // you can use that ID on the server to get file data:
            // var f = haquery.server.Lib.uploads.get(fileID)
            // f.path - path to loaded file
            // f.name - original name of the file
            // f.size - size of the file
        }
    }
}

You can use config.maxPostSize to limit file size (in bytes). Default is 16M.

version #200, modified 2013-01-29 19:49:28 by yar3333