By Arek on
I am trying to do file upload based on drupal api. the problem is that files are not uploaded and there is not any error. I have only information generated by this code "upload error". what is wrong here?
function internet_zdjecia_form($form_state) {
$form = array();
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['zdjecia'] = array(
'#type' => 'fieldset',
'#title' => 'Zdjęcia instalacji',
'#tree' => TRUE,
);
$form['zdjecia']['zdjecie1'] = array(
'#type' => 'file',
'#title' => 'Zdjęcie 1',
);
$form['zdjecia']['submit'] = array(
'#type' => 'submit',
'#value' => 'Dodaj',
);
return $form;
}
function internet_zdjecia_form_submit($form, &$form_state) {
$validators = array();
$file = file_save_upload('zdjecie1', $validators, 'files/internet/', TRUE);
if (!$file) {
drupal_set_message("Upload error!");
}
}
Comments
Permissions / File size
Check if files/intranet folder has write permissions, also check if filesize is within allowed max_upload_size.
Also take a look at error log on the server.
this code returns
this code returns "OK":
filesize is ok, I am trying upload simple (small) jpg file. I can't get error logs because my host provider do not have it...
I enabled upload module and it looks the same: when I push 'attach' button it looks like file is uploaded and after that everything looks like nothing happend (there is no attached file and no error)
I have modified file_save_upload function:
result: message "file not uploaded"
what else can I check?