cs.punk Posted July 4, 2009 Share Posted July 4, 2009 Ok guys, a naming problem. $file_dir = "photos/originals/$user_$user_id_$file_count.jpg"; move_uploaded_file ($file_tmp, $file_dir); I want a file like : ‘user_23_1.jpg’…? But it seems to be interpreting ‘$user_’ as a variable rather than ‘$user’. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/164755-solved-interpreting-8216user_8217-as-a-variable-rather-than-8216user8217/ Share on other sites More sharing options...
papaface Posted July 4, 2009 Share Posted July 4, 2009 $file_dir = "photos/originals/".$user."_".$user_id."_".$file_count.".jpg"; Quote Link to comment https://forums.phpfreaks.com/topic/164755-solved-interpreting-8216user_8217-as-a-variable-rather-than-8216user8217/#findComment-868767 Share on other sites More sharing options...
.josh Posted July 4, 2009 Share Posted July 4, 2009 That's because _ is a valid char for a variable name. Wrap your variable in braces {$user}_... Quote Link to comment https://forums.phpfreaks.com/topic/164755-solved-interpreting-8216user_8217-as-a-variable-rather-than-8216user8217/#findComment-868768 Share on other sites More sharing options...
cs.punk Posted July 5, 2009 Author Share Posted July 5, 2009 Thanks papaface and Crayon Violent! Quote Link to comment https://forums.phpfreaks.com/topic/164755-solved-interpreting-8216user_8217-as-a-variable-rather-than-8216user8217/#findComment-869112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.