/** * One of more files for 'field' were uploaded. * PHP deletes uploaded files if they are not immediately processed. This means it is possible * for a form to successfully upload a file, but not successfully validate. If the upload is not * saved, the user will have to upload the file again when resubmitting the form. Forms therefore * process each file upload as a separate transaction, so that a form can automatically store * successfully uploaded files to a 'temp' directory, where PHP can't delete them. When the form * is successfully committed, it can then move the files to their final destinations. * * The form can determine whether the file needs to be saved by checking the 'form_is_valid' flag * to see whether the form itself will be committed or not. If the file was already uploaded in a * previous form submission attempt, the file will be marked as 'processed'. * * @see CONTEXT::$upload_options * @see _move_uploaded_file() * * @param UPLOAD_FILE_FIELD $field * @param UPLOADED_FILE $file * @param boolean $form_is_valid Will the form be committed? * @access private */ protected function _process_uploaded_file($field, $file, $form_is_valid) { if (!$file->processed && $file->is_valid()) { $f = $this->_upload_folder_for($field, $file, $form_is_valid); if ($f) { $this->_move_uploaded_file($field, $file, $f, $form_is_valid); if (!file_name_to_url($file->current_name())) { $this->record_error($field->id, 'Error in upload configuration (uploaded file [' . $file->current_name() . '] is not visible under any registered mapping).'); } } } }