Create a local folder

I’ve written a CMS for a client in PHP that allows them to (among other things) add member information to a database. They asked if I can create a folder on their local network, in their office, based on the member id. Specifically on the shared S: drive on their local server. Something like:


The website is not running on this server, but on a hosted solution somewhere else.

I understand PHP is server side and won’t create anything anywhere other than on the server which its installed.

I’m hesitant to even ask the question. But it’s something I need to figure out!

Any ideas?

That can only be done by some code or script running on a local machine in their network.
If part of their network was exposed to the internet your hosted website could send a HTTP request to it, instructing the local code to create a folder.

You could do this with a web server (e.g. Apache/IIS and PHP) by installing them locally, but that seems like a bad tool for the job. I don’t know what other options exist though.

If you really wanted to do it this way the rough process would be:[LIST=1]
[]Get or find a static IP for the business’ internet connection
]Configure their router to pass HTTP port 80 traffic to the machine you’ll be installing PHP on
[]Install a web server and PHP on that machine
]Write a local script to receive a POST HTTP request (from your live server) with the name of the folder to create and some security credentials so that not anyone can run this script! It will [fphp]mkdir[/fphp]
[*]Update your live CMS to use cURL or streams to send a HTTP POST request to that IP, with the data needed to create the folder.
[/LIST]It’s kind of overkill. You’d have security implications to be aware of and local web server software to keep updated. As I said, a messy solution, but possible.

That does sound like overkill. And with the security concerns they have already, not to mention PCI compliance tests every month, they’re not going to go for it.

What client side options might there be?

I have no idea. The only way to avoid the website pushing the changes to the local network, would be for a local script to poll the website continuously for new data.

If you can stipulate a certain browser(s) only can be used to access the cms, then you could consider using [google]html5 local storage[/google] feature for key/value pairs. Its something on my todo list.

Let us know how you get on if you try it, wont you? :slight_smile:

Thanks for your help cranial-bore. I’m still going to look into your suggestion and see how it might play out.

Cups, I can specify the browser in this case.

I’ve tried using local storage for form elements, saving entry data. How would I use it to create a folder?

They don’t need a folder do they? Their version of the data they are (behind the scenes) saving is particular to them – all you have to do is make sure the keys are unique for each value you want to manipulate or access on subsequent visits?

There could well be a means of creating “folders”, but I rather think that it is easier to think of it being a new “database” instead.

Sorry to be so woolly, but as I said, I am not talking from concrete personal experience, just stuff I have read.

Unfortunately, I do need to create a folder. The concept is there will be thousands of members, each with their own folder. The folder name is the unique member id. I could then provide the user a link to open that folder in the browser and they could view the contents.

Yes but each visitor will only have one record - each visitor will not have thousands - and their own records will be stored on their browsers storage system on their hdd.

Thanks for your help Cups. It looks like the best way to handle this is to keep it on the web, and not on the local machine. I’ll build an upload script that will keep the records on the server and store the file names/paths in the database. Doing this on the local machine is asking for trouble.