Fork me on GitHub

File upload


The @upload annotation adds file upload to an ajax request. It takes the id of the HTML field as a mandatory option. It applies only to methods.

class JaxonExample
{
    /**
     * @upload('field' => 'div-user-file')
     */
    public function saveFile()
    {
        // Get the uploaded files.
        $files = $this->upload()->files();
    }
}

The PHP-DOC syntax can also be used.

class JaxonExample
{
    /**
     * @upload div-user-file
     */
    public function saveFile()
    {
        // Get the uploaded files.
        $files = $this->upload()->files();
    }
}