Ja jestem nowy w symfony i korzystam z Doctrine i nie wiem czy ciebie dobrze zrozumialem bo nic nie pisalem w generator.yml, w kazdym razie ja zrobilem tak - jeden uzytkownik moze miec tylko jeden obrazek - w ten sposob zrobilem upload:
schema.yml (uwaga

to Doctrine):
<?php
sfGuardUserProfile:
tableName: sf_guard_user_profile
columns:
id:
type: integer(4)
primary: true
autoincrement: true
user_id:
type: integer(4)
default: ''
notnull: true
unique: true
imie:
type: string(50)
default: ''
notnull: true
nazwisko:
type: string(100)
default: ''
notnull: true
email:
type: string(50)
default: ''
notnull: true
unique: true
zdjecie:
type: string(100)
notnull: true
......................................
?>
UploadForm.class.php:
<?php
class UploadForm extends sfForm
{
public function configure()
{
'plik' => new sfWidgetFormInputFile(),
));
$this->widgetSchema->setNameFormat('pliczek[%s]');
$this->setValidators(array( 'plik' => new sfValidatorFile
(array( 'required' => true,
'mime_types' => array('image/jpeg', 'image/png', 'image/gif'), 'max_size' => '1024000',
),
'required' => 'Musisz wybrać plik do załadowania.',
'max_size' => 'Plik jest większy niż 1MB.',
'mime_types' => 'Dopuszczalne są tylko pliki .jpeg, .png i .gif.',
)),
));
}
}
?>
action.class.php:
<?php
public function executeLaduj_obrazek(sfWebRequest $request)
{
$this->form1 = new UploadForm();
if ($request->isMethod('post'))
{
$this->form1->bind($request->getParameter('pliczek'), $request->getFiles('pliczek'));
if ($this->form1->isValid())
{
/*
save() - zapisuje zaladowany plik
getExtension() - zwraca rozszerzenie pliku
getOriginalName() - zwraca nazwe zaladowanego pliku
getOriginalExtension() - zwraca rozszerzenie zaladowanego pliku
*/
$id = $this->getUser()->getGuardUser()->getId();
//zaladowanie obrazka polaczone ze zmiana jego nazwy na: id zalogowanego uzytkownika + rozszerzenie obrazka, np. 1.jpg, 5.gif:
$file = $this->form1->getValue('plik');
$filename = $id;
$extension = $file->getExtension($file->getOriginalExtension());
$nazwa = $filename.$extension;
$file->save(sfConfig::get('sf_upload_dir').'/'.$nazwa);
//tutaj zapytanie wstawiajace do bazy danych nazwe obrazka
$this->redirect('/profil/index'); //przekierowanie
}
}
}
?>