Here's a patch.
Note that this opens up another bug... #542860: bytesize incorrectly converted to MB?

I've based it on your code on the project page, but not bothered with the max upload size yet.

I've written a function filefield_upload_limit_get_field_upload_limit_string() which gets the effective limit a user has for the given field -- either the per-field limit or the role limit.
I would suggest further refactoring so filefield_upload_limit_filefield uses this function (seeing how it has a bug anyway ;)

Apologies for minor patch mess -- my text editor has trimmed whitespace.

Comments

greg.harvey’s picture

Assigned: Unassigned » greg.harvey

Thanks, will review later in the week.

joachim’s picture

Status: Needs review » Fixed

Committed, as discussed on IRC.
Made a few tweaks to the comments, added proper function doxy headers on my stuff.

greg.harvey’s picture

Thank you! =)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.