Specify file valid file extensions here to restrict uploads to specific
types.

@param sAllowedExtension
The allowed extension to be added. E.g. ("jpeg", "jpg", "gif")
@return this for chaining
779545
@Nonnull
  public FineUploader5Validation addAllowedExtension (@Nonnull @Nonempty final String sAllowedExtension)
  {
    ValueEnforcer.notEmpty (sAllowedExtension, "AllowedExtension");
    m_aValidationAllowedExtensions.add (sAllowedExtension);
    return this;
  }
482337
@Override
    public boolean isFileExtensionRegistered(String fileTypeExtension) throws OSException {
        try {
            getFileExtension(fileTypeExtension);
            return true;
        } catch (OSException e) {
            return false;
        }
    }
289421
public function addDisallowedType($type)
    {
        if (!in_array(strtolower($type), $this->disallowedTypes)) {
            $this->disallowedTypes[] = strtolower($type);
        }
        return $this;
    }
1036427
def set_log_file_extension(self, logFileExtension):
        
        assert isinstance(logFileExtension, basestring), "logFileExtension must be a basestring"
        assert len(logFileExtension), "logFileExtension can't be empty"
        if logFileExtension[0] == ".":
            logFileExtension = logFileExtension[1:]
        assert len(logFileExtension), "logFileExtension is not allowed to be single dot"
        if logFileExtension[-1] == ".":
            logFileExtension = logFileExtension[:-1]
        assert len(logFileExtension), "logFileExtension is not allowed to be double dots"
        self.__logFileExtension = logFileExtension
        # set log file name
        self.__set_log_file_name()
550057
public static String getFileExtension(final String fileName) {
        if (fileName == null) return null;

        final int lastPeriodIndex = fileName.lastIndexOf(".");
        // make sure there is an extension, and that the filename doesn't end with a period
        if (lastPeriodIndex != -1 && lastPeriodIndex < fileName.length() - 1) {
            final String extension = fileName.substring(lastPeriodIndex + 1);
            return extension;
        }

        return null;
    }
1197328
protected function checkFileExtension($filename)
    {
        $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
        if (!in_array($extension, static::FILE_EXTENSION)) {
            throw new BadRequestException(
                "Unsupported file type. Supported types are " . implode(', ', static::FILE_EXTENSION)
            );
        }
        $this->extension = $extension;
    }
359877
public List<MultipartFile> validateFiles(List<MultipartFile> files, long maxLength, String[] allowExtName) {

        List<MultipartFile> retFiles = new ArrayList<MultipartFile>();

        for (MultipartFile multipartFile : files) {

            try {

                this.validateFile(multipartFile, maxLength, allowExtName);
                retFiles.add(multipartFile);

            } catch (Exception e) {

                LOG.warn(e.toString());
            }
        }

        return retFiles;
    }
578440
private function normalizeFileExtension($extension = null)
    {
        $extension = strtolower($extension ? $extension : $this->extension);

        if ($extension == 'jpeg') {
                $extension = 'jpg';
        }

        return $extension;
    }
796028
public static String addFileExtension(
      String fileName, VectorGraphicsFormat vectorGraphicsFormat) {

    String fileNameWithFileExtension = fileName;
    final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase();
    if (fileName.length() <= newFileExtension.length()
        || !fileName
            .substring(fileName.length() - newFileExtension.length(), fileName.length())
            .equalsIgnoreCase(newFileExtension)) {
      fileNameWithFileExtension = fileName + newFileExtension;
    }
    return fileNameWithFileExtension;
  }
948694
@Override
	public boolean supports(@NonNull MediaType delimiter) {

		return this.mediaTypes.stream() //
				.anyMatch(mediaType -> mediaType.isCompatibleWith(delimiter));
	}
206263
function isValidExtension(src){
   var extension = src.split('.').pop();
   var isValid = ENUM_INVALID_EXTENSIONS[extension] === false ? false : true;
   return isValid;
}
122481
public static String restrictHTML (String src, boolean allowFormatting,
        boolean allowImages, boolean allowLinks)
    {
        // TODO: these regexes should probably be checked to make
        // sure that javascript can't live inside a link
        ArrayList<String> allow = new ArrayList<String>();
        if (allowFormatting) {
            allow.add("<b>"); allow.add("</b>");
            allow.add("<i>"); allow.add("</i>");
            allow.add("<u>"); allow.add("</u>");
            allow.add("<font [^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>");
                allow.add("</font>");
            allow.add("<br>"); allow.add("</br>"); allow.add("<br/>");
            allow.add("<p>"); allow.add("</p>");
            allow.add("<hr>"); allow.add("</hr>"); allow.add("<hr/>");
        }
        if (allowImages) {
            // Until I find a way to disallow "---", no - can be in a url
            allow.add("<img [^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>");
                allow.add("</img>");
        }
        if (allowLinks) {
            allow.add("<a href=[^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>");
                allow.add("</a>");
        }
        return restrictHTML(src, allow.toArray(new String[allow.size()]));
    }
1000988
protected function setupFileExtensionsMimeTypesForValidation()
    {
        if (!is_array($this->file_extensions_mime_types) && $this->file_extensions_mime_types == null) {
            // extensions mime types was not set and not set to NOT validate (empty array).
            $default_mime_types_file = 'file-extensions-mime-types.php';
            if (is_file(__DIR__.DIRECTORY_SEPARATOR.$default_mime_types_file)) {
                $this->file_extensions_mime_types = include __DIR__.DIRECTORY_SEPARATOR.$default_mime_types_file;
            }
            unset($default_mime_types_file);
        }

        if (is_array($this->file_extensions_mime_types)) {
            // if mime types was set, change the keys to lower case.
            $this->file_extensions_mime_types = array_change_key_case($this->file_extensions_mime_types, CASE_LOWER);
        }

        if (is_array($this->allowed_file_extensions)) {
            // if allowed extensions was set, change the values to lower case.
            $this->allowed_file_extensions = array_map('strtolower', $this->allowed_file_extensions);
        }
    }
915195
@Nonnull
  public FineUploader5Validation setSizeLimit (@Nonnegative final int nSizeLimit)
  {
    ValueEnforcer.isGE0 (nSizeLimit, "SizeLimit");
    m_nValidationSizeLimit = nSizeLimit;
    return this;
  }
638623
public void setFileExtensions(final String fileExtensions) {
    this.fileExtensions = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(fileExtensions.trim().split("\\s*,\\s*"))));
  }
529577
public void setFileExtensions(String fileExtensions) {
		if ("".equals(fileExtensions.trim()))
			return;
		String[] split = fileExtensions.split("\\s*,\\s*");
		for (String string : split) {
			this.fileExtensions.add(string);
		}
	}
1224862
public Swagger2MarkupConfigBuilder withListDelimiter(Character delimiter) {
        Validate.notNull(delimiter, "%s must not be null", "delimiter");
        config.listDelimiter = delimiter;
        config.listDelimiterEnabled = true;
        return this;
    }