Hi, when trying to upload a new image using imagefield I get the error above which relates to this part of the code:
/**
* Validate the widget.
*/
function _imagefield_widget_validate($node, $field, $items) {
if ($field['required']) {
// Sum all the items marked for deletion, so we can make sure the end user
// isn't deleting all of the images.
$deleted = 0;
foreach ($items as $item) {
if ($item['flags']['delete']) {
++$deleted;
}
}
if (!count($items)) {
form_set_error($field['field_name'], t('@field is required. Please upload an image.', array('@field' => $field['widget']['label'])));
}
else if (count($items) == $deleted ) {
form_set_error($field['field_name'], t('@field is required. Please uncheck at least one delete checkbox or upload another image.', array('@field' => $field['widget']['label'])));
}
}
}
And I also figured out that the function _imagefield_widget_validate above was called from the function imagefield_js.
In 90% of the cases I don't get this mistake, but some of the users do get. I tried to replicate it from my home PC and didn't succeed. But I replicated this mistake from my work PC.
Some more details. This mistake does not depend on the browser. I tried with IE6 and FF2 at home - no problem. I tried with the same browsers at work - both fail.
I wonder if this mistake is linked somehow with the VPN/proxy/firewall/other security software installed on my office machine?
I also applied this patch http://drupal.org/node/263637 to add the "minimum resolution" option to the module. Personally, I don't see how it can cause this mistake, but FYI, just in case...
Thank you for your support!
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | Picture 1.png | 26.55 KB | jenlampton |
Comments
Comment #1
costinius commentedHi, just one more comment on the patch I applied. I didn't apply it automatically as it was created for version 5.x-2.1, but manually, in order to fit it correctly in the new line numbering (for version 5.x-2.4), just by inserting/replacing the corresponding lines of the code where needed.
Comment #2
costinius commentedOne more update: when I connect my work PC directly to the web, or remotely using VPN, I don't get this mistake. So, the only condition under which this mistake occurs is when I use my PC connected to the corporate network (with all the proxies and other layers between the browser and the web).
So, can anyone help solve this problem? Will downgrading to 2.1 version help? Thanks!
Comment #3
quicksketchI'd suggest upgrading to 2.6 that fixed several problems that were in 2.4.
Comment #4
quicksketchPlease reopen if this problem still exists in 2.6.
Comment #6
jenlamptonI'm having this problem in 2.6
Comment #7
jenlamptonwhoopsie. changing version.
Comment #8
quicksketchThanks jen, any idea how to reliably reproduce this problem?
Comment #9
jenlamptonthat's weird. there's no error now. It's a self-healing module!
let me go back to the client for more details.
Jen
Comment #10
jenlamptonOk, he's using Windows 7 + IE8. I still can't reproduce the problem on my Mac. Screenshot from his PC attached. (weird, the fieldset is empty. Do you think this could be some kind of IE8 javascript or "security enhancement" problem?)
Comment #11
quicksketchThis looks like a classic "image is too big problem". In Drupal 5, if ImageField failed because an upload was too large (larger than the server can handle, not larger than ImageField is configured to handle) then the field would just disappear entirely. If an upload exceeds the allowed POST size, then all of $_POST is entirely truncated, possibly causing the foreach() error you're seeing. Try getting the exact file the user is trying to upload and see what size it is. The FileField handbook page on increasing server upload sizes should still apply: http://drupal.org/node/422474
Comment #12
quicksketchClosing out Drupal 5 issues.