Hi, I looked at the new "experimental" form implementation again and think that the file keeps the original file name now. With the current implementation the file's name is a random token. Now I think there is a directory created with the random token and the file is moved there and so has the original file name as file name. Maybe somebody can confirm this.
What Aurelijus mentioned might already work but not when the form has validation errors and the uploaded form is kept in the temporary storage. It's a nicer workaround though. Kind regards Uwe 2011/3/29 <[email protected]>: > You can get original name from the file field object. E.g. > $form->get('filefield')->getOriginalName(); > -- > Aurelijus Valeiša > > > > On Tue, Mar 29, 2011 at 5:54 PM, dbu <[email protected]> wrote: >> hi uwe, >> >> we ran into the same problem and found no solution. this is really a >> general issue for the forms api that should be fixed. (or has it been >> fixed since last week?) >> >> what we did, and its sure ugly and against the spirit of using an >> api: >> >> // FIXME: this is a temporary workaround for a problem in the form API >> $filename = $_FILES['slide']['name']['image']['file']; >> $ext = strtolower(substr($filename, strrpos($filename, '.') + 1)); // >> or use fileinfo() >> >> cheers, >> david >> >> On Mar 11, 5:47 pm, uwej711 <[email protected]> wrote: >>> Hi, >>> >>> I have a question related to theFormcomponent andfileupload. The >>> current implementation only returns the path to the temporaryfile. >>> The other information e.g. mime type and original name is lost, when >>> the data is bound to an object. The current experimental version seems >>> to allow two approaches, either store the information as string or as >>> an array in the final object (where the originalFileobject is stored >>> in the array), but to me it is not clear whether mime type and >>> original name is available from that array, especially when theform >>> encountered validation errors. >>> >>> While the mime type could be again checked there is no way to get the >>> original name. But I can imagine use cases where you would like to >>> store that information. Additionally if you want to store thefile >>> e.g. in the PHPCR content repository you can not simply use the code >>> for mime guessing again, you probably would copy it ... >>> >>> I would love to have this information set on my domain object either >>> as an object or as an array so that it can be easily used where it is >>> needed. If I miss something here I would love to learn how it can >>> already be done! >>> >>> Kind regards >>> Uwe >> >> -- >> 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 developers" 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-devs?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 developers" 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-devs?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 developers" 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-devs?hl=en
