Posted by mazaza on September 2, 2009 at 9:06pm
Jump to:
| Project: | Video Upload |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
After creating a node with a video file uploaded, I'm not allowed to edit the node. The error message is
"Referencing to the file used in the X field is not allowed"
This bug - I guess - is related to the Filefield module and the filefield_widget_validate function, see issue http://drupal.org/node/441280
Commenting out line 421 in filefield_widget.inc
<?php
function filefield_widget_validate(&$element, &$form_state) {
// If referencing an existing file, only allow if there are existing
// references. This prevents unmanaged files (outside of FileField) from
// being deleted if this node were to be deleted.
if (!empty($element['fid']['#value'])) {
$field = content_fields($element['#field_name'], $element['#type_name']);
if ($file = field_file_load($element['fid']['#value'])) {
$file = (object) $file;
if ($file->status == FILE_STATUS_PERMANENT) {
// TODO: We could use field_file_references() here to reference any file
// but hook_file_delete() needs to be implemented first.
$references = module_invoke('filefield', 'file_references', $file);
if ($references['filefield'] == 0) {
// line 421 --> This is where the error is cast form_error($element, t('Referencing to the file used in the %field field is not allowed.', array('%field' => $element['#title'])));
}
}
}
else {
form_error($element, t('The file referenced by the %field field does not exist.', array('%field' => $element['#title'])));
}
}
}
?>does "remove" the immediate problem - but causes others. I don't know how to solve the real problem. Sorry.
Comments
#1
Committed fix to 6.x dev branch
#2
Automatically closed -- issue fixed for 2 weeks with no activity.