We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Plugin Development | Forum

Topic location: Forum home » Support » Oxwall Store
Harshita
Harshita May 3 '16
I am developing a plugin for Oxwall MarketPlace. For this I need to move a folder/file to the root directory from the plugin folder i.e 'ow_plugins/myplugin/file_to_move. I have almost developed the plugin, but I cant move the file to root. It show 'Document doesnt exist" since the file did not move to the root. It seems to be a permission issue. Is there any alternate for this? Please help.
dave Leader
dave May 3 '16
Hi Harshita, 


So if i understand this correctly you want to access a folder in the Oxwall root from your plugin correct?


Do you need a logical address as in /home/username/...... or a URL 


For the logical address do something like this: 


$filepath = $_SERVER["DOCUMENT_ROOT"]."/foldername/filename";


use this method if you want your plugin to manage files and folders from within the server.


For a url you can do it several ways.  


$file = OW_URL_HOME."directory/filename";    OW_URL_HOME already has a trailing slash /


or 


$file = OW::getRouter()->getBaseUrl()."directory/filename";   getBaseUrl also has the trailing slash /


Hope that helps.. 


Dave 



The Forum post is edited by dave May 3 '16
Harshita
Harshita May 4 '16
I have used the solution provided by you, and I can move the file to root. But only when permission is given to the root directory. If permission is not provided to the root, my file doesn't move to the root. 
dave Leader
dave May 4 '16
What is the permission of your root dir? 
Harshita
Harshita May 4 '16
755
dave Leader
dave May 4 '16
it really depends on how your using the file. Can you please explain what you are trying to do.  


Are you putting files in a root dir folder so you can call them from your plugin, or are you putting them in a root folder for people outside the site to use?   Tell me what your doing and ill try to help you.  And are they images, text files, zip files?


Also how are you calling the file?


Update:  the reason i am asking is that if you are calling the file from your plugin properly then you should have no problem. So i am guessing i am missing something here. 


By root do you mean  /home/username/public_html/yourfolder


if that is the case then you may need to add the file to your htaccess


http://www.oxwall.org/forum/topic/47116


however if this is for a plugin to use the file you need to put the folder in the oxwall dir (if it is a seperate dir)


The Forum post is edited by dave May 4 '16
Harshita
Harshita May 5 '16
That helped!!!

I made changes in the htaccess file as said. It worked...Thanx a ton!!!

dave Leader
dave May 5 '16
Your welcome but remember that if you are doing a plugin and using that file, you cant edit everyone's htaccess, or should not.   So if you need another way ask.