Hello fellow programmers, I have been fixed on this one issue for 2 days and I've still not resolved it. The problem is that I am trying to retreive a file from GoDaddy Server through php code, but am unable to do so.
This is my code:
$TargetImgPath=(string)"G:/PleskVhosts/websitedomain.com/httpdocs/Admin_Panel/".$TargetImgName
What I have tried till now:
"websitedomain.com/httpdocs/Admin_Panel/Images/".$TargetImgName;
"websitedomain.com/Admin_Panel/Images/".$TargetImgName;
"ftp://11.11.11.11/Admin_Panel/Images/".$TargetImgName;
$_SERVER['DOCUMENT_ROOT']."/Admin_Panel/Images/".$TargetImgName
file_exists(path to file); returns false
file_exists(path to file); returns false
realpath($_SERVER['DOCUMENT_ROOT']."/Admin_Panel/Images/".$TargetImgName)
returns the same as my current code ie G:/....
1)I have talked to 3 GoDaddy chat clients, all to no avail. I have done more research and have found that to use the root directory of my domain, I will have to use {DOCROOT}
. But I don't know where to use it.
I thank you for your help.
This should work:
$TargetImgPath = realpath($_SERVER["DOCUMENT_ROOT"]."/Admin_Panel/Images/".$TargetImgName);
realpath()
is the key in here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.