CMS and WWW folder path issue - less complicated than it sounds...
Posted 17 October 2006 - 02:19 PM
I need a little help with a site I've been building. I built the CMS part of a site and included within it FCKeditor text boxes with the functionality for users to upload images. Originally these images were uploaded to a folder in the CMS directory, and then the data from the form is saved into the database. Then, on the front end of the website I pull the data back out of the database and display it on the webpage.
My problem is that I want the image to display on the front end and on the back end when the user originally uploads it. Because the CMS is in the CMS folder and the front end website is in the WWW folder I can't understand where I should be getting the images to upload to from the CMS and still enable them to be viewable on the front end. In other words I can't change the url for the file from when it is saved into the database to when it is pulled back out again. This is a problem because currently the files are being uploaded to /data/betawebs/lawrencelupin/www/uploaded_files from the CMS, and this enables them to be uploaded to the WWW folder instead of the CMS folder. However on the front end of the site the url is looking for the file at http://www.websitead.../uploaded_files when really the file is stored in http://www.websitead.../uploaded_files
I'm sure it is far far less complex than I've made it out to be, but I've either explained it really well or made it 10 times more confusing that it should be.
I hope somebody can help!
Posted 17 October 2006 - 04:16 PM
Without seeing code it would be difficult to suggest a real fix, but you can use pathinfo() to return just the filename without any directory information.
<?php $path_parts = pathinfo('/www/htdocs/index.html'); echo $path_parts['dirname'], "\n"; echo $path_parts['basename'], "\n"; echo $path_parts['extension'], "\n"; ?>
Posted 18 October 2006 - 09:13 AM
blblabaablabal balablabalaba lots of information bla bla bla <img src="../../www/uploaded_files/" alt=""/> blasdf bla bla blasd more information
In order for it to display in the CMS it needs the full file path as shown above, otherwise if I just put /uploaded_files/ it will create a new folder within the CMS direectory. So as you can see, when I pull this information back out of the database at the front end, for instance...
"SELECT content FROM news"
it just bring out everything and looks for an image at ../../www/uploaded_files
I'm not sure how I could write a simple piece of code to strip this off when it comes back out of the database, as I can't do it before otherwise it won't show in the CMS.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users