Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Created May 9, 2012 14:37
Show Gist options
  • Select an option

  • Save Ocramius/2644954 to your computer and use it in GitHub Desktop.

Select an option

Save Ocramius/2644954 to your computer and use it in GitHub Desktop.
<?php
if (isset($_POST['strumento'][$cod_strum])) {
$element = new Zend_Form_Element_File('foo');
$element->setLabel('Upload an image:')
->setDestination('/home/dbstrumenti');
// ensure only 1 file
$element->addValidator('Count', false, 1);
// limit to 100K
$element->addValidator('Size', false, 102400);
// only JPEG, PNG, and GIFs
$element->addValidator('Extension', false, 'jpg,png,gif');
$form = new Zend_Form();
$form->setAttrib('enctype', 'multipart / form-data');
$form->addElement($element); //dall'esempio
echo $form->render();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment