renaming image files
Posted: Thu Dec 11, 2008 5:51 am
hi,
im trying to let users upload a profile picture of themselves on a simple website I am creating. I want the picture to be renamed to their userid number and placed in a directory containing all other profile pics, therefore I use the zend form rename filter, BUT, i can't figure out how to make it keep the original file extension:
->addFilter('Rename', '/Applications/xampp/xamppfiles/htdocs/places/web_root/img/profile/' . (int)Zend_Auth::getInstance()->getIdentity()->id);
this works fine, except it creates the file without a filename extension. Sure i could add a . '.jpg' to the end of that and it would create a jpg file but then it would also rename .gif and .png. how can i flexibly rename the filename but keep the file extension?
Thanks a lot for the help!
im trying to let users upload a profile picture of themselves on a simple website I am creating. I want the picture to be renamed to their userid number and placed in a directory containing all other profile pics, therefore I use the zend form rename filter, BUT, i can't figure out how to make it keep the original file extension:
->addFilter('Rename', '/Applications/xampp/xamppfiles/htdocs/places/web_root/img/profile/' . (int)Zend_Auth::getInstance()->getIdentity()->id);
this works fine, except it creates the file without a filename extension. Sure i could add a . '.jpg' to the end of that and it would create a jpg file but then it would also rename .gif and .png. how can i flexibly rename the filename but keep the file extension?
Thanks a lot for the help!