Media Directory As Parameter

Hi lets say i have loop that list all my media file in certain dir… I prefer to save all my media into database, that is saving all my images location. now in my situation i already list my media, like this




	 	$media=glob($_POST['id']."*.*");

		$j;	 

		for($i=0;$i<count($media);$i++){

		$image=$media[$i];

		$j=$i+1;

		echo "<tr>";	

		list($width, $height,$date)=getimagesize(getcwd().'/'.$image);

		$myext=getimagesize($image);

		$basename=basename($image);

		

		echo "<td><h6>".$j."</h6></td>";

		echo "<td><div style='width:50px;overlay:hidden'>".CHtml::image("/".$image)."</div></tD><td>".CHtml::link($basename,array('/media/media_details/create','params'=>$image))."</td><td>".$width." x ".$height."</td></td>";

		echo "<td>".$myext['mime']."</td></tr>";


		}

		echo "</table>";




see the params in my CHTML::link i want the $image(contains the media locations) to pass as a parameter to other controller(crud) to add additional description to media before saving to database together with its description in image… any better idea how to do it or better approach…

Hi

It is preferable to do it in component instead Controller.

Make a component method that save all desired info to database.

If these info belongs to related model you can create model method instead component method.