You are here

function asset_file_validate in Asset 6

Same name and namespace in other branches
  1. 5.2 asset.types.inc \asset_file_validate()

Implementation of hook_asset_type('validate') for file asset type

File

./asset.types.inc, line 92
This file is included by asset_asset_type() and includes all the file and directory specific functions

Code

function asset_file_validate($asset) {
  if (!$asset->aid && !file_check_upload('upload')) {
    $ftp = variable_get('asset_ftp_dir', '');

    // if ftp uploads are allowed and no localfile was selected
    if ($ftp && $asset->localfile == '#') {
      form_set_error('upload', t('You must upload a file or select one from the list.'));
    }
    elseif (!$ftp) {
      form_set_error('upload', t('You must upload a file.'));
    }
  }
}