Hi I am trying to learn PHP. I've got a problem I cannot get my head around. I'm trying to copy over a script from one of my sites to another to function in exactly the same way. I have created the database etc and all is working ok apart from one aspect: This script inputs an image on a page based on a form. $target_path = "../ads_pic/"; Code (markup): in the databse of the old site it inputs this as "ads_pic/imagename.jpg" In the new database it adds this as "../ads_pic/imagename.jpg" This means the actual image will not show as I get a url like this http://www.mydomain.com/..ads_pic/imagename.jpg Where am I going wrong? Thanks a lot and hope this makes sense
hi you want it work with new one then store the script at the same level of images folder otherwise you have to make changes to db .. means parent directory ,if the script is in root or not at same level of images folder then it wont show obviously Regards Alex
thanks for coming back to me. Yes the image directory is the same. The form uploads the images to the correct directory no problem. It just seems to add the .. to the url whereas the old site did not add the .. to the actual url?
You're getting that bogus URL with the embedded ".." because somewhere in your script the site's root URL is being concatenated with the contents of the $target_path variable. Apparently on your original site the variable for the root URL contained an empty string, so you got a proper relative URL as a result. On your new site, the variable for the root contains "http://www.mysite.com/" (from your example), so you're getting that bogus result. Look for code that concatenates some variable with $target_path. In other words, $some_variable . $target_path, and you'll have the culprit. To preserve the relative URL, you'll want to eliminate the first part of that. I hope this helps. Steve
Steve that is very kind and your explanation was easy to understand for even a complete newbie Thanks - rep added