简体   繁体   中英

Root Directory php in GoDaddy not found

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:

  1. Used "websitedomain.com/httpdocs/Admin_Panel/Images/".$TargetImgName;
  2. Used "websitedomain.com/Admin_Panel/Images/".$TargetImgName;
  3. Used "ftp://11.11.11.11/Admin_Panel/Images/".$TargetImgName;
  4. Used $_SERVER['DOCUMENT_ROOT']."/Admin_Panel/Images/".$TargetImgName
  5. Checked file_exists(path to file); returns false file_exists(path to file); returns false
  6. Used 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM