ericp Posted August 9, 2013 Share Posted August 9, 2013 Hi, Regarding script 13.3, which is the more reliable way of confirming a file’s type using the Fileinfo extension. I understood. However, the example script 13.3 I could see shows that the codes (... if (finfo_file($fileinfo, $_FILES['upload']['tmp_name']) == 'text/rtf') {...) only check and validate only one type of file, called .rtf. Is there other ways that we can validate multible types of file using the Fileinfo extention, e.g., .jpg, .gif, .docx, ect? Thanks Link to comment Share on other sites More sharing options...
margaux Posted August 9, 2013 Share Posted August 9, 2013 Hi, You could set up an array of allowed file types and check if the file extension is in that array. See this thread. 1 Link to comment Share on other sites More sharing options...
ericp Posted August 9, 2013 Author Share Posted August 9, 2013 Hi, You could set up an array of allowed file types and check if the file extension is in that array. See this thread. Thanks, But the variable $array('x','y','z') as in script 11.2 as per your recomendation is to check the MIME type of the particular files the browser can do. What I mean is to be able to apply the Fileinfo extension into the syntax of the multiple file's types verification or not? Would I code if (finfo_file($fileinfo, $_FILES['upload']['tmp_name']) == 'text/x', 'image/JPG') { or if (finfo_file($fileinfo, $_FILES['upload']['tmp_name']) == $allowed) { or what? Thanks Link to comment Share on other sites More sharing options...
Larry Posted August 9, 2013 Share Posted August 9, 2013 First of all, are you running two separate threads for the same issue? Is this the same issue as: http://www.larryullman.com/forums/index.php?/topic/2553-file-upload-ch-11-how2-cad-file-types/&do=findComment&comment=15906 ??? Link to comment Share on other sites More sharing options...
ericp Posted August 9, 2013 Author Share Posted August 9, 2013 yes, because margaux complicated it. Link to comment Share on other sites More sharing options...
Larry Posted August 9, 2013 Share Posted August 9, 2013 Okay, well I very much appreciate Margaux's help (and anyone that helps) but will close this thread. Link to comment Share on other sites More sharing options...
Recommended Posts