public function actionOuterLinkPhotos($id) { $this->layout = '//layouts/new/main'; $model = $this->loadModel($id); if (isset($_POST['uploadOuterLinkImage']) && $_POST['uploadOuterLinkImage']) { $images = CUploadedFile::getInstancesByName('OuterLinkImage'); if ($images) { foreach ($images as $num => $pic) { $photo = new OuterLinkImage(); $photo->recordId = $id; $photo->file = $pic; if (!$photo->save()) { echo "<pre style='color:blue' title='" . __FILE__ . "'>" . basename(__FILE__) . ":" . __LINE__ . "<br>"; print_r($photo->getErrors()); echo "</pre>"; } } } } $this->render('photos', array('model' => $model)); }