[symfony-users] Re: file upload example?

2011-06-22 Thread Chris

In beta5 that problem I described is now solved, but there's another
one:
when preUpload() gets called, the field 'file' is not filled in
(reference: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html)
so I have no way to call  'file-guessExtension()'. Any idea??

 -- btw I am testing using (persisted) collections of file objects --


On Jun 15, 6:56 pm, Chris christophe.ben...@gmail.com wrote:
 Thanks for these, though I'm trying to implement multiple files
 upload: using a collection of a FileFormType that contains a file.
 I am now stuck at the bindrequest step.

 In my controller I loop through all the items in the ArrayCollection
 and do $files[$i]-upload() to mimick what's in that documentation.

 But there's a problem before that because bindRequest throws a
 tantrum:
   Expected argument of type array, string given
   500 Internal Server Error - UnexpectedTypeException

 Is there something different in the process here to upload a
 collection of files?

 On 14 juin, 07:55, Fabien Potencier fabien.potenc...@symfony-







 project.com wrote:
  On 6/11/11 12:24 PM, Ruben de Vries wrote:

   Are there any bundles on github that demonstrate a fileupload?

   I'm trying to implement handling the fileupload but I'm not really
   sure how to do it 'the symfony way'

   So some source code to dig through on github would be really helpfull
   (A)

 https://github.com/symfony/symfony-docs/blob/master/reference/forms/t...

 https://github.com/symfony/symfony-docs/blob/master/cookbook/doctrine...

  Fabien

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: file upload example?

2011-06-22 Thread oscar balladares
Have you try a postPersist event?

If that is working, and prePersist not, then you can use the postPersist. If
the fileupload returns an exception, then the persist
won't be commited anyway.

Also, on a postPersist event you have access to the Entity's id, which is
very useful for generating an unique name for the file.

On Jun 15, 6:56 pm, Chris christophe.ben...@gmail.com wrote:
  Thanks for these, though I'm trying to implement multiple files
  upload: using a collection of a FileFormType that contains a file.
  I am now stuck at the bindrequest step.
 
  In my controller I loop through all the items in the ArrayCollection
  and do $files[$i]-upload() to mimick what's in that documentation.
 
  But there's a problem before that because bindRequest throws a
  tantrum:
Expected argument of type array, string given
500 Internal Server Error - UnexpectedTypeException
 
  Is there something different in the process here to upload a
  collection of files?
 
  On 14 juin, 07:55, Fabien Potencier fabien.potenc...@symfony-
 
 
 
 
 
 
 
  project.com wrote:
   On 6/11/11 12:24 PM, Ruben de Vries wrote:
 
Are there any bundles on github that demonstrate a fileupload?
 
I'm trying to implement handling the fileupload but I'm not really
sure how to do it 'the symfony way'
 
So some source code to dig through on github would be really helpfull
(A)
 
  https://github.com/symfony/symfony-docs/blob/master/reference/forms/t.
 ..
 
  https://github.com/symfony/symfony-docs/blob/master/cookbook/doctrine.
 ..
 
   Fabien

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en