jtracey0380 Posted March 13, 2010 Share Posted March 13, 2010 $upload_path = ',,/images/$file_name/'; // this is not working OK - there is a name stored in $file_name - i know this for a fact - i've tested it all over the place. I need the value of $file_name to show up in the code and it is not. for some strange reason. this is a file upload script and it works perfect when i simply add the stored value by hand. here is what i've tried so far $file_name "file_name" <php echo $file_name; ?> '.$file_name.' if you have any suggestions please let me know. thank you!!! John Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/ Share on other sites More sharing options...
GalaxyTramp Posted March 13, 2010 Share Posted March 13, 2010 Hi John You have an error in the code it should be $upload_path = '../images/$file_name/'; and not $upload_path = ',,/images/$file_name/'; Does this only occur here and not in your page code? Can we see the rest of the query so its possible to see where $file_name gets its value from. Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/#findComment-1025721 Share on other sites More sharing options...
Instigate Posted March 13, 2010 Share Posted March 13, 2010 You will also need to put it as: $upload_path = '../images/{$file_name}/'; Instead of what you have now. Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/#findComment-1025725 Share on other sites More sharing options...
GalaxyTramp Posted March 13, 2010 Share Posted March 13, 2010 $upload_path = '../images/$file_name/'; will return something like: ../images/my-image.jpg/ why have you got the extra slash on the end? $file_name="my-image.jpg"; $upload_path ="../images/$file_name"; echo $upload_path returns: ../images/my-image.jpg You do not need the curly braces?? Hope this helps Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/#findComment-1025737 Share on other sites More sharing options...
Instigate Posted March 13, 2010 Share Posted March 13, 2010 I have always used moustaches when echoing a variable within a variable. Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/#findComment-1025738 Share on other sites More sharing options...
GalaxyTramp Posted March 13, 2010 Share Posted March 13, 2010 And with the braces: $upload_path ="'../images/{$file_name}'"; :-\ Link to comment https://forums.phpfreaks.com/topic/195131-upload_path-imagesfile_name-help/#findComment-1025745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.