Image Function Problem Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziycon
    Contributor
    • Sep 2008
    • 384

    Image Function Problem Function

    The below function works properly when the its called by:
    Code:
    storeExtraImages("n","news",1);
    But when called by these next two line's it gets to if(move_uploade d_file($_FILES[$img]['tmp_name'], $target_path.$i mage_name.".".$ filetype)) and doesn't move the image and doesn't enter the record into the DB.
    Code:
    storeExtraImages("r","reviews",2);
    storeExtraImages("p","previews",3);
    Code:
    function storeExtraImages($type,$table,$type_id) {
      if(($_FILES['extra_img_1'] != "") || ($_FILES['extra_img_2'] != "") || ($_FILES['extra_img_3'] != "") || ($_FILES['extra_img_4'] != "") || ($_FILES['extra_img_5'] != "")) 
      {  
        for($i=1;$i<6;$i++)
        {
          $image_name = "";
          $img = 'extra_img_'.$i;
          if($_FILES[$img]['name'] != "")
          {
            $filetype = "png";
            $articleID = getImageID($table);
          
            $target_path = "../images/ex/";
            
            $image_name = $articleID."-".$type."-".getNextImageID();
                    
            if(move_uploaded_file($_FILES[$img]['tmp_name'], $target_path.$image_name.".".$filetype))
            {
              mysql_query("INSERT INTO article_images VALUES (NULL,'".$articleID."','".$type_id."','".$filetype."')");
            }
          }
        }
      }
    }
    Any ideas??
  • ziycon
    Contributor
    • Sep 2008
    • 384

    #2
    Got it sorted, just read another thread there, it looks like its down to the size aloud! :D

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Allowed. :P

      I was going to refer you to that thread, but you'd already replied before I could.

      Glad you got it sorted,

      Markus.

      Comment

      • dumm
        New Member
        • Dec 2008
        • 10

        #4
        if(($_FILES['extra_img_1'] != "") || ($_FILES['extra_img_2'] != "") || ($_FILES['extra_img_3'] != "") || ($_FILES['extra_img_4'] != "") || ($_FILES['extra_img_5'] != ""))


        Should be :

        if(($_FILES['extra_img_1']["name"] != "") || ($_FILES['extra_img_2']["name"] != "") || ($_FILES['extra_img_3'] != "") || ($_FILES['extra_img_4']["name"] != "") || ($_FILES['extra_img_5']["name"] != ""))

        Comment

        Working...