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. 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"; 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}_... 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! 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
Archived
This topic is now archived and is closed to further replies.