Uploading images in Forum

Uploading images in Forum, a forum discussion on Jojo CMS. Join us for more discussions on Uploading images in Forum on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
lynchpin

19 Jun 2008
Posts: 60

I can't seem to get images to upload in the Forum plugin. It gives me a "File upload error. Script will now halt."
I'm guessing I need to create a folder or change permissions or something but can't find out where.
Any ideas?
Harvey

Core Developer

Harvey

19 Jun 2008
Posts: 327

These images get uploaded to mysite/downloads/forums/

Main thing that could go wrong is the downloads directory not having write permissions for the web server user.

It's usually best to make the web server user the owner of the downloads folder.

Let me know if this works.
lynchpin

19 Jun 2008
Posts: 60

that folder did not exist, so I created it and gave 755 permissions. Still get the same error.
All the other folders within mysite/downloads/ are working and accepting uploads so it seems to be something localized to the forum. Site link is below. Feel free to create an account on the forum and try it out.
http://www.axewraps.com/forum/
lynchpin

19 Jun 2008
Posts: 60

ok..so I traced the error back to line 163 of 'jojo_forum.php' and noticed that it was trying to upload to a directory called 'forum-images'. I manually created this directory and it worked!
Harvey

Core Developer

Harvey

19 Jun 2008
Posts: 327

I thought it created that automatically, but apparently not. I'll fix that one up for the next release.

Nice site design by the way.
lynchpin

19 Jun 2008
Posts: 60

great..thanks for checking it out for me.

thanks on the site! We are currently working on an Adobe Flex widget to customize guitar skins that will be the main draw of the site.

This will be my first deployed site using Jojo so I'm pretty excited for that. Until now I've basically setup every site I've done on both Jojo and my own CMS just testing it out. Most of our clients are churches, so I am hoping to write a sermons manager plugin, then use Jojo for everything.
Harvey

Core Developer

Harvey

19 Jun 2008
Posts: 327

Awesome, sounds neat.

Let me know if there are any tweaks needed for the forum, or if you need to make changes to the core and want them incorporated into the main release.

The forum works pretty well for what it is, but we haven't really had any demand to add any new features to it, and we have actually been pretty happy with it's functionality. Any ideas you have to make it easier / faster / better, we will usually be open to (within reason of course).
lynchpin

20 Jun 2008
Posts: 60

Here's a question that may or may not be related to the forum.
For this site I have created a form so that artists can upload their designs, then site administrator gets a link to the upload via email. The form:
http://www.axewraps.com/artists/

I would like to integrate this upload option with the Jojo user management, so that users create an account, then are allowed to upload numerous files and images, and in the admin section under users, have another tab for uploaded files.
If I have to I will create a plugin for it I suppose, but I don't want to re-invent the wheel is something similar to this exists, or if you think there is a suitable plugin that I can modify.
Thanks!
Harvey

Core Developer

Harvey

20 Jun 2008
Posts: 327

You will need to create a plugin for the upload script anyway - a simple plugin for displaying the form, doing the validation, handling the file upload etc.

To incorporate the Jojo user system into this, use the $_USERID variable to test whether they are authenticated. You will need to use the 'global' keyword to make sure the variable is in the scope of your function.

function _getContent()
{
global $_USERID;
if (!empty($_USERID)) {
//user is logged in
} else {
//user is not logged in
}
}


There is further testing you can do to see if a user belongs to a certain group etc.

In terms of showing the extra tab in the 'edit users' section, I'll update the docs to explain this one, there's a bit more to it.
lynchpin

20 Jun 2008
Posts: 60

thanks for the info.
I think I will just leave it how it is for now, and use this method later on, assuming the client still needs it. This form may be a temporary feature of the site anyway.
Harvey

Core Developer

Harvey

20 Jun 2008
Posts: 327

Here's an example plugin I just created demonstrating how to add a new field type.

Yeah, I kinda made this just for you, but it needed to be done anyway, so no harm done if it's not needed straight away.

Start with eading the readme, then follow the comments in the source code. Once you understand how it works, please feel free to edit the comments / readme and send me your revised version if you feel something could be explained better - would appreciate any input on this. I'll include this plugin in the plugin pack when I get a chance.

Attached Files

lynchpin

20 Jun 2008
Posts: 60

thanks...thats great! I will check it out and let you know my thoughts
lynchpin

21 Jun 2008
Posts: 60

That was easier than I thought it would be.
I followed the readme and installed without any problem. I then had to add a new page and give it the plugin 'Core - Admin Edit Table Contents'. That was straightforward by looking at other edit pages, but wasn't in the readme at all. It looks like that is automatically done in most plugins anyway, so probably not a big deal.

the one thing that didnt make sense was #9 in the readme.
9. There is a field named "Type" which defines what type of data and handling is required of the field. If you have setup api.php correctly, your new field type should appear in this list. If you need to go back and tweak api.php for any reason, you will need to run setup again after every change, as changes are cached.

I couldnt find anything to do with Type, but everything worked anyway. I also didn't do much with the api.php and ended up setting up the fields manually in the fielddata.

Another random issue, when I try to edit tabledata, the page spits out a bunch of sql queries.

Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.