Esempio n. 1
0
								case (add):
									if (empty($_FILES))
									{
										?>
										<form enctype="multipart/form-data" action="album.php?action=add&id=<?php 
echo $_GET['id'];
?>
" method="post">
											<input id = "button15" type="file" name="photo"/>
											<input id = "button15" type="submit" value="Загрузить"/>
										</form>
										<?
									}
									else
									{
										$result = Photos::uploadPhoto($_GET['id'], $_FILES);
										if (!$result['error'])
										{
											echo "<h1 id = 'content_header_name'> Фотография успешно добавлена. </h1>";
										}
										else
										{
											echo "<h1 id = 'content_header_name'> При добавлении фотографии произошла ошибка. </h1>";
										}
									}
									break;
							}
						?>
					</div>
				</div>
				<div class = "clear"></div>
 public function actionUploadMyPhotosHandler()
 {
     if (Yii::app()->user->isGuest) {
         $this->unsuccessfulAjaxResponse(array('redirect_url' => $this->createUrl('index')));
     } else {
         try {
             $response = Photos::uploadPhoto(Yii::app()->user->id);
             $this->successfulAjaxResponse($response);
         } catch (Exception $e) {
             $this->unsuccessfulAjaxResponse(array('errorMessage' => $e->getMessage()));
         }
     }
 }