I've been using the FileField this weekend in a project, and I'm struggling to get the original name of the file after binding the form - I always get the temporary name returned. I'm not sure if this is a bug - I can remedy this by swapping a couple of lines around in FileField but I'd like to get confirmation I'm accessing the File object correctly if possible.
My controller has the following: $fileObj = new MyFile(); $form = new MyForm::create($this->get("form.context"), "myFile"); $files = $this->get("request")->files->get($form->getName()); $form->bind($this->get("request"), $fileObj); if ($form->isValid()) { $fileIWant = $files["formFileField"]["file"]; $newPath = "/path/to/somewhere"; // I want the original filename here, so I can move it and rename accordingly. $fileIWant->move($newPath); } Using $fileIWant->getName() I can only get the temporary name, rather than the original name of the uploaded file, which is what I want to keep the file named as in its new location. I've made a slight change to the FileField class which allows me to retrieve the original name from $form->get("filename")->getDisplayedData() but I'm feeling this is a bit hackish - I'm not sure if this is a bug or not. The change I've made is at https://github.com/richsage/symfony/commit/8128553ff5ff3fefccd78314b861180d567fffa1- the FileField test passes with or without this change in place so I suspect there is a test issue somewhere as well. Can anyone shed some light on the above? Am I going about this the wrong way? Thanks, Rich. -- Rich Sage York, UK rich.s...@gmail.com -- 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