is there any solotion to check that file is selected to upload or not.
I want to use this file optional.

here is my code

    if (isset($_FILES['files[letter_file]']))
    {
        $letter_file = file_save_upload('letter_file', $validators, CS_UPLOAD_DIR);
        if (!$letter_file) {
            form_set_error('letter_file', t('letter file is not correct'));
        }
    }

I confused what drupal handel this mater!

I just want to upload file if file posted, otherwise it is not reason to validate and upload it

Comments

if no file is chosen, nothing will happen

I'm not sure I understand your problem. If the user doesn't select a file, the form will not try to upload the file.

If you built this custom form, AND you made the field required, then the form api will always require the user to upload a file.