Jump to content
Sign in to follow this  
aradhya

restricton on file upload type...

Recommended Posts

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..

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...