I have problem with file upload. When i don't use ajax everything works perfect, but with ajax:
1.i need to choose file,
2. then submit it, and
3. repeat the same actions second time.
How this is could be fixed? is it ajax problem? or maybe i need to use another functions? My code bellow:
<?php
function Diary_insert_class_form($form, &$form_state){
$form = array();
$form['class_fieldset'] = array(
'#type' => 'fieldset',
'#title' => 'from file'
);
$form['class_fieldset']['click'] = array(
'#type' => 'checkbox',
'#title' => 'click for file upload',
'#ajax' => array(
'callback' => 'ajax_classes_from_file_callback',
'wrapper' => 'class-fromfile-div',
'progress' => array('type' => 'none'),
),
);
$form['sup'] = array(
'#prefix' => '
',
'#suffix' => '
',
);
if(!empty($form_state['values']['click']) && $form_state['values']['click'] == 1){
$form['sup']['file_fieldset'] = array(
'#type' => 'fieldset',
'#title' => 'new file'
);
$form['sup']['file_fieldset']['file'] = array(
'#type' => 'file',
'#title' => 'file name'
);
$form['sup']['file_fieldset']['submit'] = array(
'#type' => 'submit',