Upload text file without extension I am working in a project where I have to upload files thru a Drupal site. I am having an issue since the files I am trying to upload have not extension. The files are text files, but without the .txt at the end and to be honest I don't mind if Drupal add .txt after the file name.

How do I define a file validator for files without extensions?
I found out that leaving the extension with an space instead of empty work, but I wonder how secure it this solution. In my case I remove the file a second after I upload it as I am only interested on its content.

Here is the code that worked for me:

$validators = array('file_validate_extensions' =&gt; array(' '));
$file = file_save_upload($i, $validators);


Thank you.