aradhya Posted October 22, 2010 Share Posted October 22, 2010 i have a question...i am allowing users to upload files on website but i want to restrict certain types of files....lyk i dont want any executable files....so how do i do that?...plz help.. Link to comment Share on other sites More sharing options...
[dx] Posted October 22, 2010 Share Posted October 22, 2010 Upload your exe file, then when move uploaded file use echo to get format of exe file:echo $_FILES['file']['type'];And then use:if ($_FILES["file"]["type"] == "that_result") {I don't know what is format of it.Example: for jpeg images is image/jpeg Link to comment Share on other sites More sharing options...
aradhya Posted October 22, 2010 Author Share Posted October 22, 2010 function notAllowedExtension(){ $fnme = strtolower($_FILES['file']['name']); $backlist = array('php', 'php3', 'php4', 'phtml','exe'); $ext = substr(strrchr($fnme, '.'), 1); echo" <script type='text/javascript'> alert('Invalid file:executable files are not allowed!'); </script> ";return(in_array($ext, $backlist));}got it...thnx for da help nevayz... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.