robert_gsfame Posted December 5, 2009 Share Posted December 5, 2009 i allow users to upload their document * doc format and stored inside folder and i've put some limitation that document other than * doc format cannot be uploaded using this script $filetype=$_FILES['file']['type']; if($filetype!='application/msword'){ echo "doc* format only";}else{ COPY FILES INTO FOLDER but the problem is that when i try to upload the * doc format file, "doc* format only" appear and file not copied into the folder This just happened in MOZILLA browser ! but it works well in IE 6.0 What is wrong with the code, can anyone give some solution regarding this problem?? Quote Link to comment Share on other sites More sharing options...
cags Posted December 5, 2009 Share Posted December 5, 2009 Different browsers sometimes use different MIME types. Echo out $_FILES['file']['type'] when uploading a document that you know to be valid. Then see where to go from there. You should see that it isn't applicatoin/msword so you can just check if it's equal to application/msword || 'whatever'. This is one of the reasons it's important to test your code on as many different browsers as possible. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.