alconebay Posted April 10, 2008 Share Posted April 10, 2008 How would I put a variable in the URL of $upload_path? I want this: $myvariable = thumbnail $upload_path = "../pics/$myvariable-image/" To send the image being uploaded to: ../pics/thumbnail-image/ But its not working with the variable (it works if I put "thumbnail" in place of the variable, so the script is fine). Should I format the variable differently? I tried quotation marks around it, parenthesis.... No go. Link to comment https://forums.phpfreaks.com/topic/100510-solved-putting-a-variable-in-url-of-upload_path/ Share on other sites More sharing options...
GingerRobot Posted April 10, 2008 Share Posted April 10, 2008 You need to enclose thumbnail in quotes, and add a semi-colon: $myvariable = 'thumbnail'; $upload_path = "../pics/$myvariable-image/"; Link to comment https://forums.phpfreaks.com/topic/100510-solved-putting-a-variable-in-url-of-upload_path/#findComment-514016 Share on other sites More sharing options...
papaface Posted April 10, 2008 Share Posted April 10, 2008 You need to enclose thumbnail in quotes, and add a semi-colon: $myvariable = 'thumbnail'; $upload_path = "../pics/$myvariable-image/"; Either that or:$myvariable = 'thumbnail'; $upload_path = "../pics/".$myvariable."-image/"; Link to comment https://forums.phpfreaks.com/topic/100510-solved-putting-a-variable-in-url-of-upload_path/#findComment-514030 Share on other sites More sharing options...
alconebay Posted April 10, 2008 Author Share Posted April 10, 2008 Works! Thanks. I had the " ; "s but not the " ' "s around the variable. Link to comment https://forums.phpfreaks.com/topic/100510-solved-putting-a-variable-in-url-of-upload_path/#findComment-514034 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.