When binding the form, you have to pass the files specifically:
$this->form->bind($request->getParameter('photoform'),
$request->getFiles('photoform'));
Fabien
--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.com | aide-de-camp.org
Tél: +33 1 40 99 80 80
Yohan 'rouKs' G. wrote:
> Yes and the more strange is thar a var_dump($_FILES) give this :
>
> array(1) {
> ["photoform"]=>
> array(5) {
> ["name"]=>
> array(1) {
> ["photo"]=>
> string(8) "eepc.jpg"
> }
> ["type"]=>
> array(1) {
> ["photo"]=>
> string(10) "image/jpeg"
> }
> ["tmp_name"]=>
> array(1) {
> ["photo"]=>
> string(14) "/tmp/phpyPPtau"
> }
> ["error"]=>
> array(1) {
> ["photo"]=>
> int(0)
> }
> ["size"]=>
> array(1) {
> ["photo"]=>
> int(599584)
> }
> }
> }
>
> so, the upload work, but symfony don't reconize the file...
>
>
>
> Alistair Stead wrote:
>> Have you set the form to be multi-part?
>>
>> Regards
>>
>>
>> Alistair
>>
>> 2008/5/7 Yohan 'rouKs' G. <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>:
>>
>>
>> I've got the same result after a symfony fix-perms and a chmod -R
>> 777 *
>> in my symfony directory
>>
>> Tom Haskins-Vaughan wrote:
>> > Are you permissions on the upload directory set correctly?
>> >
>> > Yohan 'rouKs' G. wrote:
>> >
>> >> Yes of course :D
>> >> I don't ask for a validator wich make his job...
>> >> Others fields of my forms work perfectly but I can't send files :/
>> >>
>> >> Dmitry Nesteruk wrote:
>> >>
>> >>> Did you chose a file for upload? This field is required.
>> >>>
>> >>> 2008/5/7 Yohan 'rouKs' G. <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>
>> >>> <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>>:
>> >>>
>> >>>
>> >>> Don't work :(
>> >>>
>> >>> I've got this message :
>> >>>
>> >>> * Click browse and choose one of your photos to apear
>> on your
>> >>> profile
>> >>>
>> >>>
>> >>> Dmitry Nesteruk wrote:
>> >>> > yes, you can
>> >>> >
>> >>> > Example:
>> >>> >
>> >>> > ----- actions.class.php ------
>> >>> >
>> >>> > if ($this->form->isValid()) {
>> >>> >
>> >>> > $file = $this->form->getValue('photo')
>> >>> > ;
>> >>> > $path = "/tmp/file.";
>> >>> > $extension = strtolower($file->getExtension($file-
>> >>> > >getOriginalExtension()));
>> >>> > $file->save($path.$extension);
>> >>> >
>> >>> > }
>> >>> >
>> >>> > --------
>> >>> >
>> >>> > ---- PhotoForm.class.php ------
>> >>> > class PhotoForm extends sfForm
>> >>> > {
>> >>> > public function configure()
>> >>> > {
>> >>> > $this->setWidgets(array(
>> >>> > 'photo' => new
>> >>> > sfWidgetFormInputFile(),
>> >>> > ));
>> >>> >
>> >>> > $this->setValidators(array(
>> >>> > 'photo' => new
>> >>> > sfValidatorFile(array('required' => true,
>> >>> >
>> >>> > 'max_size' =>
>> '1024000', //
>> >>> bytes (1MB)
>> >>> >
>> >>> > 'mime_types' =>
>> >>> array('image/jpeg')
>> >>> >
>> >>> > )),
>> >>> > ));
>> >>> >
>> >>> >
>> >>> >
>> $this->validatorSchema['photo']->setMessage('max_size', 'File
>> >>> size
>> >>> > limit is 1MB, please make your file smaller');
>> >>> >
>> $this->validatorSchema['photo']->setMessage('mime_types', 'The
>> >>> > file you submit is not a valid format. Please upload a
>> JPG, GIF
>> >>> or PNG
>> >>> > image file');
>> >>> >
>> $this->validatorSchema['photo']->setMessage('required', 'Click
>> >>> > browse and choose one of your photos to apear on your
>> profile');
>> >>> >
>> >>> > $this->widgetSchema->setNameFormat('photoform[%s]');
>> >>> > $this->errorSchema = new sfValidatorErrorSchema($this-
>> >>> > >validatorSchema);
>> >>> > }
>> >>> >
>> >>> > }
>> >>> >
>> >>> >
>> >>> > 2008/5/7 Yohan 'rouKs' G. <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>
>> >>> <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>
>> >>> > <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>>>:
>> >>> >
>> >>> >
>> >>> > Hi all,
>> >>> >
>> >>> > I've got a problem with file upload in sf1.1. Validating
>> >>> alway miss
>> >>> > with the message 'requested'.
>> >>> >
>> >>> > How can i upload files in 1.1 ?
>> >>> >
>> >>> > Thanks.
>> >>> >
>> >>> >
>> >>> >
>> >>> > >
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>
>> >
>> > >
>> >
>> >
>>
>>
>>
>>
>>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---