unplugged_web Posted December 23, 2013 Share Posted December 23, 2013 I'm trying to get a file to upload to a folder depending on which is different depending on what option the user has selected. The folder name is sent in the $designer variable but I'm not sure how to add it to code I've got. $pic = $_FILES['photo']['name'];$target = '/home/linweb22/f/domain.com/user/htdocs/new/designers/images/' . basename( $_FILES['photo']['name']);$temp_name = $_FILES['photo']['tmp_name'];$type = $_FILES["photo"]["type"]; I tried adding it to the target line so that it was like this: $target = '/home/linweb22/f/domain.com/user/htdocs/new/designers/images/$designer/' . basename( $_FILES['photo']['name']); But all I got was an error saying that the folder wasn't there. If I try adding it without the $designer variable then it submits okay but I do need it to be in a different folder depending on the option selected. Thanks Link to comment Share on other sites More sharing options...
thescientist Posted December 23, 2013 Share Posted December 23, 2013 (edited) try using double quotes so $designer is interpolated inside the string, or else concatonate all the parts together. $target = '/home/linweb22/f/domain.com/user/htdocs/new/designers/images/' . $designer . basename($_FILES['photo']['name]); Edited December 23, 2013 by thescientist Link to comment Share on other sites More sharing options...
unplugged_web Posted January 3, 2014 Author Share Posted January 3, 2014 Sorry I think I made a mistake in the original post, the target needs to be like this: $target = '/home/linweb22/f/domain.com/user/htdocs/new/designers/images/designer/' . basename( $_FILES['photo']['name']); I've tried doing it like this but it doesn't work: $target = '/home/linweb22/f/domain.com/user/htdocs/new/designers/images/$designer/' . basename( $_FILES['photo']['name']); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now