tag:blogger.com,1999:blog-4186074565961060437.post7464375671800178733..comments2024-01-30T19:03:09.916-07:00Comments on The Abstracts of My Brain: Uploading a File in Symfony 1.4Unknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-4186074565961060437.post-36891981158789559702011-05-20T17:06:59.524-06:002011-05-20T17:06:59.524-06:00@Daniel yeah, he gets the hero award from me too. ...@Daniel yeah, he gets the hero award from me too. This just saved me tons of time.Brent Andersonhttps://www.blogger.com/profile/15957650826137717752noreply@blogger.comtag:blogger.com,1999:blog-4186074565961060437.post-9038067696651821682011-04-06T22:56:11.266-06:002011-04-06T22:56:11.266-06:00Hi,
I looked at this as well, with version version...Hi,<br />I looked at this as well, with version version: 1.4.11<br />I was able to use the file validator in the admin generated backend.<br />In the doSave method of the generated formclass I had<br /><br /><br /> $file = $this->getValue('image'); //tbs - change to image1, image2...<br /> if ( $file )<br /> {<br /> $filename = sha1($file->getOriginalName().microtime().rand()).$file->getExtension($file->getOriginalExtension());<br /><br /> $savedName = $file->save($uploadDestPath . $filename);<br /> $newSavedName = $file->setSavedName( $filename);<br /><br />Where file is a sfValidatedFile object.<br />the $file->save call works, however it saved the value to the database with the entire file system path.<br />I added a call setSavedName to just set it as the name I want.John Reidyhttps://www.blogger.com/profile/00488071052191988158noreply@blogger.comtag:blogger.com,1999:blog-4186074565961060437.post-7411285669033805192011-01-12T01:29:31.387-07:002011-01-12T01:29:31.387-07:00You are my hero of the day, thanks!You are my hero of the day, thanks!Danielhttps://www.blogger.com/profile/13758941809352774543noreply@blogger.com