This is all I have.
<?php if ((($_FILES["file"]["type"] == "file/exe") && ($_FILES["file"]["size"] < 20000000)) { I need to only upload .exe file types, how can I do this? reg ex?(PHP)
I think that you should use something like finfo_file. As far as I know, $_FILES["file"]["type"] can be spoofed by the uploader to anything he wants it to be.
There is no reliable way to do that as all information that is sent by the client can be tampered with.
I would simply check the file name extension like:
if (strncasecmp(substr($_FILES["file"]["name"], -4), '.exe') === 0) { // is .exe } Additionally, you could look for specific magic numbers.
Just make sure that if you want to deliver that file you’re using a proper MIME media type (e.g. application/octet-stream).
In addition, you can also check MIME type for each file .exe executable files has always application type of mime
pplication/octet-stream, application/x-msdownload, application/exe, application/x-exe, application/dos-exe, vms/exe, application/x-winexe, application/msdos-windows, application/x-msdos-program