MyBB Community Forums

Full Version: [F] Attachments for New Threads [with fix]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This line is the problem.

Line 142 of newthread.php
	if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && $mybb->settings['maxattachments'] == 0 && $attachcount < $mybb->settings['maxattachments'])

It appears to be right as far as each variable is what it should be. So I guess it's related to the logic. I am pretty sure this is the line though causing the issue. I will try to find one that works.

Fixed.

	if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments']))

The second operator looks for if max attachments = 0 OR attachcount is less than max attachments. It was set to AND...it's impossible for them both to be true.

Also some error handling should be added if this fails because no errors are displayed like "max attachments reached" or anything.

I tried to test my fix in all scenarios but of course I hope the mybb team does it's best to make sure I didn't screw up. Smile
Hey just noticed this:


Ryan..your upgrade (changed files) from 1.4.1 to 1.4.2 has the correct line however...the current MYBB 1.4.2 from front page has the &&.

At mybb central I looked at my file wondering why it worked and well..I had your changed files package with the OR statement. Smile

So I guess you need to change the download on home page and possible release a notice or whatever the heck you decide to do.

Thanks.
(2008-09-27, 01:26 AM)labrocca Wrote: [ -> ]Ryan..your upgrade (changed files) from 1.4.1 to 1.4.2 has the correct line however...the current MYBB 1.4.2 from front page has the &&.

Ugh, I wonder how that happened :|
(2008-09-27, 03:05 AM)Ryan Gordon Wrote: [ -> ]
(2008-09-27, 01:26 AM)labrocca Wrote: [ -> ]Ryan..your upgrade (changed files) from 1.4.1 to 1.4.2 has the correct line however...the current MYBB 1.4.2 from front page has the &&.

Ugh, I wonder how that happened :|

I just hope nothing else is wrong in the main download. Any way you can make sure the latest version has all current fixes? Mistakes happen too..no biggie. This project is starting to get big ain't it. Harder and harder to manage I would assume.
Okay, the package is updated. And no, I don't personally have a way / the ability to check the package for all the fixes.

I'm moving this to "Forum and Website" since it was a problem with the download package
(2008-09-27, 06:53 PM)Ryan Gordon Wrote: [ -> ]Okay, the package is updated. And no, I don't personally have a way / the ability to check the package for all the fixes.

I'm moving this to "Forum and Website" since it was a problem with the download package
Well, it was a bug in the code really. For users that have an earlier 1.4.2 download, might it be an idea to cross-post this under Fixed Bugs or somewhere more obvious than this board for people seeing this issue?
(2008-09-29, 10:29 AM)SteelD Wrote: [ -> ]Well, it was a bug in the code really. For users that have an earlier 1.4.2 download, might it be an idea to cross-post this under Fixed Bugs or somewhere more obvious than this board for people seeing this issue?
Exactly my problem - I've been looking in bugs to track this problem and subscribing to other threads on the same problem. A more direct route would have been fixed bugs. Thanks for the fix.
Cross posted under fixed bug reports
Hi all,

I seem to be still having a problem with trying to attach a photo to a message, I uploaded the newthread.php file and still the same problem. Anybody else still having problems ? or did I miss something in this thread.

Chmod is writeable 777
In the Upload directory there is 2 folders,
200810
Avatars
the avatars file attributes is 777
the 200810 file "" "" is 755 , I change it to 777 but made no difference, any ideas?
Thanks
Dale
Great the first post with the fix was solving every problem! Great Job!

Cool
i'v upgrated to 1.4.3, and now i can't upload files again,