[RESOLU] Zebra form -> upload file

Mammouth du PHP | 619 Messages

19 juin 2013, 17:27

Bonjour,

Je tente d'utilise la classe Zebra Form pour faire mes formulaires j'ai aucun problème sauf pour Upload un fichier



require 'zebra_form/Zebra_Form.php';
	$form = new Zebra_Form('form','POST','');
	$form->show_all_error_messages(true);
	$form->language('francais');

if ($form->validate()) {
print_r($_FILE['monavatar']);
}

$form->add('label', 'label_monavatar', 'monavatar', 'Votre propre Avatar');
	$obj = $form->add('file', 'monavatar');
	$obj->set_rule(array(
	
		'required'  =>  array('error', 'Merci de selectionne une image!'),

        // error messages will be sent to a variable called "error", usable in custom templates
        'upload'    =>  array('tmp', ZEBRA_FORM_UPLOAD_RANDOM_NAMES, 'error', 'Could not upload file!<br>Check that the "tmp" folder exists inside the "examples" folder and that it is writable'),

        // notice how we use the "image" rule instead of the "filetype" rule (used in previous example);
        // the "image" rule does a thorough checking aimed specially for images
        'image'  =>  array('error', 'Votre avatar doit etre au format jpg, png ou gif!'),
        'filesize'  =>  array(1024000, 'error', 'Taille maximun 100Kb!'),

    ));

$form->add('submit', 'btnsubmit', 'Modifier');

Merci

Mammouth du PHP | 619 Messages

19 juin 2013, 17:35

Erreur de ma part

j'ai oublie un s a $_FILES ^^