Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-18-2012, 12:22 AM   PM User | #1
RonnyNishimoto
New Coder

 
Join Date: Jul 2012
Posts: 85
Thanks: 53
Thanked 0 Times in 0 Posts
RonnyNishimoto is an unknown quantity at this point
Counting an array

PHP Code:
$allowed = array("jpg""jpeg""gif""png");
if (
$_FILES["file"]["type"] == "images/"(for(0count($allowed); i++))) {
    
}
else {} 
How would I make this work? It would be "images/(each file type in the array)".

Last edited by RonnyNishimoto; 07-18-2012 at 01:07 AM..
RonnyNishimoto is offline   Reply With Quote
Old 07-18-2012, 12:53 AM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,896
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
this would probably be easier ?
PHP Code:
$allowed = array("images/jpg""images/jpeg""images/gif""images/png"); 
if(
in_array($_FILES["file"]["type"],$allowed)){
    
//all good

__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

Last edited by firepages; 07-18-2012 at 03:08 AM..
firepages is offline   Reply With Quote
Users who have thanked firepages for this post:
RonnyNishimoto (07-18-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:37 AM.


Advertisement
Log in to turn off these ads.