How to Upload images in the Admin Domain, and Save them in images folder in another domain (blog)?

Here is my problem, I have two domain names, lets say, x.epizy.com (users domain) and y.epizy.com (admin domain). They are using the same database.
I upload everything from the admin website and save in the common database, where the other site, x.epizy.com is fetching from. My problem comes when am uploading images to be used by x. Here is what I want to do, I want to upload images in the admin website, save the image in the images folder in the other site. and save the link to the database. The link is saving correctly but the image is not uploaded.
Is what am trying to do possible? And if yes, how can I achieve that?
Your help will be highly appreciated.
Thanks in advance.

  • Is the stored URL has correct structure? (e.g.: http://mysecondary-web.tld/my_path/uploaded_stuff/myImage.png; or similar to). Please note that you can’t use relative-type URL when accessing stuff outside your web/server, regardless of its ownership

  • If image wasn’t uploaded, you may want to check the $_FILES, and its upload form. See if you can find what causes them unable to be stored in your server.

In case of confusion, please refer here: https://www.w3schools.com/php/php_file_upload.asp

Update: I hope this post is still relevant
https://forum.infinityfree.net/discussion/comment/2758/#Comment_2758

Hotlinking may still prohibited here, sorry :smiley:

It’s not possible for scripts on one domain to access files on another domain, even within the same account. So scrips on x.epizy.com cannot access files on y.epizy.com and vice versa. I think that makes it quite hard to do what you’re trying to do on free hosting.

Some workarounds which might help (outside of upgrading, of course):

  • Move both services to the same domain and use sub paths to separate areas (e.g. x.epizy.com for users and x.epizy.com/admin for admins).
  • Store the files in the database as BLOB cells (quite bad for performance - not recommended).
  • Store the files on an external file storage.
  • Build an upload endpoint for admins in the user site so files are only stored on the user site. Or vice versa. Or on a separate subdomain. Plenty of options here. Just keep in mind that you can’t embed stuff from a different domain, so keep that in mind on which domain you want to serve the files form.