Uploaded files from one domain to another (same database)

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 28, 2010   (RSS)

Hey

take this for example:
domainone.com/CMSB <-- record created here

domaintwo.com/CMSB runs of exactly the same database so new record is displayed

However for uploads, the upload in domainone.com/CMSB is /root/domainone.com/blaa

Which domaintwo.com also tries to use, however its root is not /root/domainone.com, but /rootdomaintwo.com

Is there an easy way around this, other than writing code in domaintwo.com to say if no file, then look at www.domainone.com/filepath?

Thanks!!!

Re: [rjbathgate] Uploaded files from one domain to another (same database)

By Chris - October 27, 2010

Hi rjbathgate,

I think the simplest solution is to only use CMS Builder's admin panel on one domain, then hardcode that domain into the URLs for uploads on all other domains.

Does that help?
All the best,
Chris

Re: [rjbathgate] Uploaded files from one domain to another (same database)

By Chris - October 28, 2010

Hi rjbathgate,

Here's a sneaky solution for you: if your upload URLs are different on each site, you could have your front-end PHP code examine the URL and prefix a host depending on what the path is.

For example, domainone could use /cmsAdmin/uploads/domainone/ for uploads, while domaintwo could use /cmsAdmin/uploads/domaintwo/. Your <img/> display code would then search the image's URL for "domainone" and "domaintwo" and prefix either http://domainone.com/ or http://domaintwo.com/

Make sense?
All the best,
Chris

Re: [chris] Uploaded files from one domain to another (same database)

yeah, thats a nice idea, thanks. Saves running an if file_exists over and over again.

Thanks for the idea!