krash11554 Posted September 18, 2012 Share Posted September 18, 2012 This foreach loop in my function isnt working. It only moves the pictures when $image_temp is one picture, but when $image_temp is an array, i thought it should loop around again and move the other images. i cant seem to figure out why it isnt looping around again. heres the function. function addcar_uploaddata($num_rows,$image_ext,$image_temp,$user_id,$car_data){ $user_id = (int)$user_id; array_walk($car_data, 'array_sanitize'); $fields = '`' . implode('`, `', array_keys($car_data)) . '`'; $data = '\'' . implode('\', \'', $car_data) . '\''; mysql_query("INSERT INTO cars ($fields) VALUES ($data)"); $num_rows = $num_rows + 1; $car_id = mysql_insert_id(); $car_file = $car_id . '.' . $image_ext; mkdir('uploads/cars/' . $_SESSION['user_id'] . '/car' . $num_rows,0744); mkdir('uploads/cars/' . $_SESSION['user_id'] . '/thumbs',0744); foreach($image_temp as $image_temps){ move_uploaded_file($image_temps, 'uploads/cars/' . $_SESSION['user_id'] . '/car' . $num_rows . '/' . $car_file); create_thumb('uploads/cars/' . $_SESSION['user_id'] . '/' . 'car' . $num_rows , $car_file, 'uploads/cars/' . $_SESSION['user_id'] . 'thumbs/',150,150); } } allot of the function you dont need to see but i put it in anyway Quote Link to comment https://forums.phpfreaks.com/topic/268491-moving-multiple-pictures-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.