By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,184 Members | 1,530 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,184 IT Pros & Developers. It's quick & easy.

Image Function Problem Function

100+
P: 384
The below function works properly when the its called by:
Expand|Select|Wrap|Line Numbers
  1. storeExtraImages("n","news",1);
But when called by these next two line's it gets to if(move_uploaded_file($_FILES[$img]['tmp_name'], $target_path.$image_name.".".$filetype)) and doesn't move the image and doesn't enter the record into the DB.
Expand|Select|Wrap|Line Numbers
  1. storeExtraImages("r","reviews",2);
  2. storeExtraImages("p","previews",3);
Expand|Select|Wrap|Line Numbers
  1. function storeExtraImages($type,$table,$type_id) {
  2.   if(($_FILES['extra_img_1'] != "") || ($_FILES['extra_img_2'] != "") || ($_FILES['extra_img_3'] != "") || ($_FILES['extra_img_4'] != "") || ($_FILES['extra_img_5'] != "")) 
  3.   {  
  4.     for($i=1;$i<6;$i++)
  5.     {
  6.       $image_name = "";
  7.       $img = 'extra_img_'.$i;
  8.       if($_FILES[$img]['name'] != "")
  9.       {
  10.         $filetype = "png";
  11.         $articleID = getImageID($table);
  12.  
  13.         $target_path = "../images/ex/";
  14.  
  15.         $image_name = $articleID."-".$type."-".getNextImageID();
  16.  
  17.         if(move_uploaded_file($_FILES[$img]['tmp_name'], $target_path.$image_name.".".$filetype))
  18.         {
  19.           mysql_query("INSERT INTO article_images VALUES (NULL,'".$articleID."','".$type_id."','".$filetype."')");
  20.         }
  21.       }
  22.     }
  23.   }
  24. }
Any ideas??
Dec 11 '08 #1
Share this Question
Share on Google+
3 Replies


100+
P: 384
Got it sorted, just read another thread there, it looks like its down to the size aloud! :D
Dec 11 '08 #2

Markus
Expert 5K+
P: 6,050
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.
Dec 11 '08 #3

P: 10
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"] != ""))
Dec 14 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.