In fact the tmp file is both the easiest and the cleanest way. It's just 2 or 3 lines of code and it completely separates the form from the specifics of how flash posts file data.
That is, if you really need a symfony form for this - if you are posting a true ByteArray, there is only the raw post data as flash cannot send other post params besides the ByteArray. In this case, an sfForm is probably overkill. If you *do* need to send other post parameters along with the file data, you will need to post your ByteArray as an Base64 encoded string. In this case the best option is to write a validator extending sfFileValidator. You new validator should encapsulate the decoding of the base64 string and the tmp file logic, and you can then use symfony forms seamlessly with any data posted from Flash. Cheers, Andreas On 23 Dez., 15:47, isleshocky77 <[email protected]> wrote: > So I'm just changing the subject on this cause it really is how I can > get a file which I have passed in as a byteArray from flash to be used > by a form class. Not sure if I should manually save it to a tmp file > first and the pass an array to the form class with the proper > information or there is an easier and cleaner way to do this. > > Thanks for any help. > > -- > Stephen Ostrow > > On Dec 22, 5:56 pm, isleshocky77 <[email protected]> wrote: > > > > > I'm using ZendAMF with symfony and having a form in flash submit > > information to a service in symfony. I wanted to know if anyone had > > best practices for doing something like this. It does include a file > > which is where I'm running into the problems. > > > So far I have this:http://isleshocky77.pastebin.com/f1434534c > > > /** > > * Uploads an Image and sets its information > > * > > * @param array $image_array The Image which contains all > > information about the Image > > * @param byteArray $image_file The image file as a byteArray > > * > > * @todo Complete and test > > * > > */ > > public function upload($image_array, $image_file) > > { > > $ImageForm = new ImageServiceImageForm(); > > > # Do something with image file > > # @todo > > > $ImageForm->bind($image, $image_file); > > > if ($ImageForm->isValid()) { > > $ImageForm->save(); > > return "Success"; > > } else { > > return "Error"; > > } > > > } > > > Thanks for any help > > > -- > > Stephen Ostrow -- 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.
