You are here

function pack_upload_file_validate in Pack & Upload 7

Implements hook_file_validate().

File

./pack_upload.module, line 183
This is the module file for pack and upload.

Code

function pack_upload_file_validate($file) {
  $errors = array();
  $result = db_query('SELECT f.fid FROM {file_managed} f WHERE f.uri = :uri', array(
    ':uri' => $file->destination,
  ));
  $output = $result
    ->fetchObject();
  if (is_object($output)) {
    $errors[] = t("A file already exist with the same name. Please try uploading by renaming this file.");
  }
  return $errors;
}