Skip to content

forms ajax upload

David Spreekmeester edited this page Dec 2, 2014 · 1 revision

Creating an AJAX file upload field

Add the class hijack-upload:

<?php
$this->addElement('file', 'avatar', array(
	'class' => 'hijack-upload',
	'label' => 'Avatar'
));
?>

You can configure the following:

<?php
'data-type' => Garp_File::TYPE_DOCUMENTS,
'data-allowed-extensions' => 'pdf',
'data-max-file-size' => 10,
'data-max-files' => 1,
?>

File-size is in MB.

Clone this wiki locally