Question

I've just been tasked with abstracting the admin section of a website to its own separate domain on a separate (shared) hosting plan. Part of what the admin section does is upload pictures for products. Now that this admin section is no longer a part of the main domain, how can I upload products onto the main domain from the admin domain?

I'm using ASP.NET/VB.NET.

Thanks

EDIT Let me add that both systems are on shared hosting plans, so I don't really have any sort of ability to map drives or anything. I was looking for a programmatic way. Is there a way to have one site "call" the other and tell it which files to save onto the server?

Was it helpful?

Solution

If they're on the same box, you can have one site write to the other site's file system (given the right permissions). But this sounds like it won't work in your shared hosting environment, though.

Otherwise, you could provide a URL for the main app to load images from the admin app, just make sure the images are saved to a place where they're accessible to the public.

OTHER TIPS

You can setup a webservice on the non-admin domain that will be called by the admin domain. So when you upload a new image in admin you:

  • select the file to upload
  • submit the form (postback)
  • in the file upload event handler, call a web service on the non-admin domain with necessary details (name, content, etc)
  • in the webservice, you save the file, update a db, etc. and return whatever data is necessary for the admin page to know where the image is stored
  • the admin page continues processing

It is far from being as easy as sharing a folder, but it would work.

Is the money saved on a shared server worth the time of implementing this? Who knows...

I have not yet found a more elegant solution, so I'm hoping you'll get a better answer than mine. I'm also not sure if this is even possible based on your setup.

What I normally do in this case is to do one of two options. Both involve mapping a network drive from the server where the images are uploaded to and then copying the files from the admin site to the main site.

Either I copy the files as soon as they are uploaded, or I write a separate script to copy the files. Possibly, on the Admin site, I would list the files that need to be copied and do the copy on a button click.

EDIT - added after the fact

This is one of those challenges that comes up regularly for me. Due to the extra overhead involved, I almost never put my admin site on a different server than the main site. The above methods are used only where I absolutely need to do this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top