CakePHP Variable becomes empty

<?php
class UploadsController extends AppController {
var $name = 'Uploads';
var $components = array('Auth');
var $uses = array('Upload');

function beforeFilter() {
    $this->Auth->allow('*');
}

function upload($event) {
    App::import('Vendor', 'UploadedFiles', array('file' => 'UploadedFiles.php'));

    $user = $this->Auth->user('id');
    $this->set('user', $user);
    if(!$this->Auth->user()) { $this->Session->setFlash(__('Please login.', true)); }
    echo $user;
    echo $event;

    $vardir = date('d-m-Y');
    $dir = 'img/gallery/'.$vardir.'/';
    $thmbdir = 'img/gallery/'.$vardir.'/thumbnails/';    
    if(!is_dir($dir)) {
        mkdir($dir, 0777);
        mkdir($thmbdir, 0777);
    }
    $galleryPath = $dir;

    $absGalleryPath = realpath($galleryPath) . '/';
    $absThumbnailsPath = realpath($galleryPath . 'thumbnails/') . '/';

    //Iterate through uploaded data and save the original file, thumbnail, and description.
    while(($file = UploadedFiles::fetchNext()) !== null) {
      $fileName = $file->getSourceFile()->getSafeFileName($absGalleryPath);
      $file->getSourceFile()->save($absGalleryPath . '/' . $fileName);

      $thumbFileName = $file->getThumbnail(1)->getSafeFileName($absThumbnailsPath);
      $file->getThumbnail(1)->save($absThumbnailsPath . '/' . $thumbFileName);

        $this->Upload->create();
        $this->Upload->set(array(
            'name' => $absGalleryPath . $fileName,
            'width' => $file->getSourceFile()->getWidth(),
            'height' => $file->getSourceFile()->getHeight(),
            'description' => $file->getDescription(),
            'event_id' => $event,
            'user_id' => $user
          ));
        $this->Upload->save();
    }
  }
}

Check the last part of the code where I try to save to the database. It doesn't save because $event and $users become empty. But when I echo them (line 17 and 18), they do appear on the page with correct values. It seems that they are being 'erased' in the while loop...
If I put some dummy data for 'event_id' => '123' and 'user_id' => '123', the scripts saves successfully. But if I use the variables, it doesn't save. What happens with my variables? Any idea?

Thanks