koolaid Posted July 24, 2008 Share Posted July 24, 2008 I am building an mp3 player CMS. I have everything working, but to make my cms more functional i would like to have all the data write to a temporary folder. Then before going live to the public the user can view what the finished page will look like. When the user hits save the temporary folder will write over the currently live folder. Is this possible? Could anyone point me in the direction of a good tutorial for this. Or does anyone have a snippet i can modify? Thanks freaks Quote Link to comment Share on other sites More sharing options...
koolaid Posted July 24, 2008 Author Share Posted July 24, 2008 Sorry i didn't mean to bump this thread i just forgot to add, That i have all the files writing to the temp folder already. I just need to know how to write over an existing directory if this is possible. Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 24, 2008 Share Posted July 24, 2008 The best way to do this, from my perspective, would be to delete the existing directory and rename the temp directory. The 2nd post on this PHP manual page has a function to delete an entire directory that has contents. http://us.php.net/manual/en/function.unlink.php Then rename using this command: http://us.php.net/rename Quote Link to comment Share on other sites More sharing options...
koolaid Posted July 24, 2008 Author Share Posted July 24, 2008 Awesome i wasn't sure the best practice there. I didn't even think of deleting the live directory first. I will give that a shot. Just wondering, but would there be issues trying to write over a directory by naming a folder the same name as an existing folder? (just curious) Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 24, 2008 Share Posted July 24, 2008 Awesome i wasn't sure the best practice there. I didn't even think of deleting the live directory first. I will give that a shot. Just wondering, but would there be issues trying to write over a directory by naming a folder the same name as an existing folder? (just curious) I'm not sure. You could also just copy the contents of the temp directory to the existing directory. But, both of those methods have a flaw. If you have any file in the existing directory that does not exist in the temp directory, then copying or overwriting will not remove those unneeded files. Quote Link to comment Share on other sites More sharing options...
koolaid Posted July 24, 2008 Author Share Posted July 24, 2008 Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.