public function _validation_upload_ok($form_value, $form_field) { // Get files uploaded with errors $upload_errors = Upload::get_errors(); // Check if this form field had an upload error foreach ($upload_errors as $error) { if ($error['field'] == $form_field) { $this->set_message('upload_ok', $error['message'] . ' (' . $error['name'] . ').'); return false; } } return true; }
public static function set_form_fields_example(Fieldset $form, $example_id = null) { if ($example_id != null) { $examples = self::get_example_info($example_id); } // File upload - set up several fields for ($i = 1; $i <= Model_Mexamples::N_FILES; $i++) { $field = 'file_' . $i; $field_id = 'file-' . $i; $form->add($field, "Upload File $i", array( 'type' => 'file', 'size' => 50, 'id' => $field_id, ), array( array('upload_ok', "$field"), ) ); }
It looks like you're new here. If you want to get involved, click one of these buttons!