Mr.Shawn Posted March 27, 2009 Share Posted March 27, 2009 Hello all, I would like to ask if I can upload files to a folder in the TLD (top-level domain) from which I access the PHP file from sub-domain. Example: http://something.yourdomain.com/upload.php to store files in http://yourdomain.com/files/ Quote Link to comment https://forums.phpfreaks.com/topic/151363-solved-sub-domain-upload-file-to-tld/ Share on other sites More sharing options...
chronister Posted March 27, 2009 Share Posted March 27, 2009 I guess it depends on how your site is set up. But I would imagine that you could use the absolute server path to denote where you want files to live. if you echo $_SERVER['DOCUMENT_ROOT'] you will get the path like /server/homepages/d150919797/htdocs/name_of_web_root you just need to determine where each site lives and use the proper path. Nate Quote Link to comment https://forums.phpfreaks.com/topic/151363-solved-sub-domain-upload-file-to-tld/#findComment-795059 Share on other sites More sharing options...
Mr.Shawn Posted March 27, 2009 Author Share Posted March 27, 2009 /home/myaccount/files is the folder that I would like to store files in while the sub-domain actually points to /home/myaccount/something/ So just by using $_SERVER['DOCUMENT_ROOT'] would let me do what I wanted? Quote Link to comment https://forums.phpfreaks.com/topic/151363-solved-sub-domain-upload-file-to-tld/#findComment-795123 Share on other sites More sharing options...
chronister Posted March 27, 2009 Share Posted March 27, 2009 No, $_SERVER['DOCUMENT_ROOT'] will give you the root of where the site lives. I gave that as a way to get the path that you want. If you wish to upload the files in /home/myaccount/files, then just point the move_uploaded_files destination to that. I believe that will work. If that does not work, then you can do FTP through PHP. I have done this before when uploading files between TLD and Sub-Domain. Hope this helps a bit. Quote Link to comment https://forums.phpfreaks.com/topic/151363-solved-sub-domain-upload-file-to-tld/#findComment-795554 Share on other sites More sharing options...
Mr.Shawn Posted April 1, 2009 Author Share Posted April 1, 2009 $_SERVER['DOCUMENT_ROOT'] would help in a sub-domain situation. I should have thought of that. Thank you so much. Quote Link to comment https://forums.phpfreaks.com/topic/151363-solved-sub-domain-upload-file-to-tld/#findComment-798646 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.