doubledee Posted February 21, 2012 Share Posted February 21, 2012 I have a variable that holds the name of a File... $origFileName = $_FILES['userPhoto']['name']; What is the best way to just get the File Name from this? Debbie Link to comment https://forums.phpfreaks.com/topic/257442-file-name-with-extension/ Share on other sites More sharing options...
QuickOldCar Posted February 21, 2012 Share Posted February 21, 2012 I'm sorry , I misread and thought wanted the extension. pathinfo(); Link to comment https://forums.phpfreaks.com/topic/257442-file-name-with-extension/#findComment-1319462 Share on other sites More sharing options...
trq Posted February 21, 2012 Share Posted February 21, 2012 I have a variable that holds the name of a File... $origFileName = $_FILES['userPhoto']['name']; What is the best way to just get the File Name from this? Debbie You just said you have a variable containing the file name already. Link to comment https://forums.phpfreaks.com/topic/257442-file-name-with-extension/#findComment-1319465 Share on other sites More sharing options...
QuickOldCar Posted February 21, 2012 Share Posted February 21, 2012 I thought she meant the file name minus the extension. something like $path_parts = pathinfo($origFileName); echo $path_parts['filename']; Link to comment https://forums.phpfreaks.com/topic/257442-file-name-with-extension/#findComment-1319468 Share on other sites More sharing options...
trq Posted February 21, 2012 Share Posted February 21, 2012 Or better yet: $filename = pathinfo($origFileName, PATHINFO_FILENAME); Link to comment https://forums.phpfreaks.com/topic/257442-file-name-with-extension/#findComment-1319469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.