Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    85
    Thanks
    53
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,051
    Thanks
    10
    Thanked 94 Times in 92 Posts
    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

    Last edited by firepages; 07-18-2012 at 03:08 AM.
    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)

  • Users who have thanked firepages for this post:

    RonnyNishimoto (07-18-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •