Page 1 of 1

I want to use a subdomain to upload image to main domain

Posted: Thu Jun 05, 2014 11:04 am
by simonmlewis

Code: Select all

$target = $_SERVER['DOCUMENT_ROOT']."/images/uploads/";
I'm using this script to tell a small upload script where to send a file.
Under "httpdocs" this works. But under "demosite.site.com" it doesn't... becuase I want it to upload it to the main httpdocs folder, where I will reference to it from the main site too.

I thought I could do it like this:

Code: Select all

$target ="http://www.site.com/images/uploads/";
But that doesn't work at all. Should it? Or is there a better way of using the first version, but with an alternation??

Re: I want to use a subdomain to upload image to main domain

Posted: Thu Jun 05, 2014 11:07 am
by Celauran
You need to specify the file path, not the URL. How to accomplish that really depends on where your subdomain lives relative to your parent domain. Certainly listing the path as a configuration setting will work, though it's not terribly robust/portable.