The upload module stores these two particular variables as a number of megabytes so we need to multiply by 1024^2 as happens elsewhere for these messages. Seeing that something exceeeds a 1 byte quota is a bit disconcerting when you have 1 MB.

I made the patch against HEAD, but the problem does exist in 4.6.x.

CommentFileSizeAuthor
upload.module_4.diff2.02 KBdrumm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dries’s picture

Can't we store the size in bytes instead of having to multiply with '1024 * 1024' over and over again?

Dries’s picture

Note: this patch does not apply against DRUPAL-4-6. For HEAD, we might be better of removing the multiplications, as stated in my previous comment.

drumm’s picture

The value is stored with a call to system_settings_save() and the UI currently accepts a number of MB. I can't think of a good way to actually store the number of bytes instead of MB as the user entered. I suppose the best code cleanup for now would be grabbing the value in MB, multiplying, and storing in a locally scoped variable.

If I have time later today I can make patches for both 4.6 and HEAD.

Dries’s picture

OK. The patch does not apply against HEAD though.

Steven’s picture

I fixed it in HEAD and 4.6. I moved the multiplications to right where the variable is fetched. That way it doesn't need to be multiplied again later.

Anonymous’s picture