Down- and uploading files.

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
dhampson
Forum Newbie
Posts: 19
Joined: Mon Mar 24, 2008 8:01 pm

Down- and uploading files.

Post by dhampson »

So, I have a php front end to a SQL database. I would like for the administrator account to have a simple button that when gets pressed, a "Save as..." box opens, and a backup of the data base is then downloaded onto the client's hard drive.

Similarly, a second button would use open up an "Open file" dialog box, and upload the backup to "restore" the database.

I have no idea where to even begin searching for how to do these things. Everything I've seen involves linking to static files. I can manually backup and restore the data base through the shell, it shouldn't be too hard to for me to do that, it's just the file management I need help with.

Thanks.

--Dave
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: Down- and uploading files.

Post by jmut »

Well for upload you need..... http://php.net/file_upload
For downloads... you just need correct headers on downloading the file. I am sure there is tons of stuff online.

In general you can do stuff in two stpes... first is generate backup button... that will exec some mysqldump for example and store file
Then script will see this file..and offer download button.
On way back same storry. upload stuff... then commit resotre button. But with the restore you should be carefull...Should check recommended way of restoring.

Of course there might be much more elegant ways...but thats a start.
Although I doubt this web approach on such sensitive matter is a good solution altogether.
Post Reply