Jump to content

moving multiple pictures problem


krash11554

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/268491-moving-multiple-pictures-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.