fork download
  1. <?php
  2.  
  3. /**
  4.  * @property string $id
  5.  * @property string $name
  6.  */
  7. class Image extends CActiveRecord {
  8. public $image;
  9. public function rules(){
  10. return array(
  11. array('image', 'file', 'types'=>'jpg, gif, png'),
  12. );
  13. }
  14. }
  15. class ImageController extends Controller {
  16. public function actionIndex(){
  17. $this->render('index');
  18. }
  19. public function actionCreate(){
  20. $model=new Image;
  21. if(isset($_POST['Image'])){
  22. $model->attributes = $_POST['Image'];
  23. $model->image = CUploadedFile::getInstance($model, 'image');
  24. if($model->save()){
  25. $model->image->saveAs('images');
  26. $this->refresh();
  27. }
  28. }
  29. $this->render('create', array('model'=>$model));
  30. }
  31. }
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Class 'CActiveRecord' not found in /home/i0WvGp/prog.php on line 7