'Possible to upload from a subdomain to the main domain?

Ok so this is my server structure...

ROOT
  -PUBLIC_HTML
     --IMAGES
  -SUBDOMAIN

As you can see, the subdomain is located on the root alongside the public_html. How can i upload a file from the subdomain (subdomain.site.com) to the public_html/images (site.com/images) folder? or is this not possible?

Thanks.

php


Solution 1:[1]

In my case my sub domain and main domain were both inside the public_html.

public_html:

  • sub domain
  • uploads

uploading happens in sub domain. So in my file path variable I just added ../

 ex: $path = "../uploads"

to go outside the current directory from subdomain to maindomain.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raymond Shafiee