In all of my node types I have several image fields. If I delete one image and then uploads a new one and then repeats this for a second and third image field, all works as expected.

BUT if I do this same thing in a clone of the node, WITHOUT saving the new node first, I get this message:

Irreversible error, Uploaded file probably exceeds the maximum file size limit (2 mb), supported by this server

(something like that, translated from my language), directly when I hit the delete button for the second image. Before I even try to upload this second image.

The workaround for the time being is to save the clone first and then delete the old images and upload the new ones.

But what is this? I have never seen this behaviour before. My Drupal version is 7.52 and I use the Node clone module, version 7.x-1.0, together with the Node clone tab module, version 7.x-1.1.


1 Answer 1


What module are you using to clone a node? I recommend the Replicate module A workaround on your case now would be to alter the replicate functionality for the replication of image fields. You can clear the images field in code or copy the files yourself.

Here is an example for the replicate module to copy the images so your nodes don't use the same images because then you have unwanted behaviour on delete of one of the nodes (deletes the images):

 * Implements hook_replicate_field_FIELD_TYPE().
function replicate_custom_replicate_field_image(&$replica, $entity_type, $field_name) {
   // List of affected fields.
   $fields_list = array(
     'field_xxxx' => 'contenttype1',
     'field_xxxxx' => 'contenttype2',
     'field_xxxxxx' => 'contenttype3',
     'field_xxxxxxx' => 'contenttype4',
     'field_xxxxxxxx' => 'contenttype5',

   if (in_array($field_name,  array_keys($fields_list))) {
     // Fetch field instance info.
     $field_instance = field_info_instance($entity_type, $field_name,           $fields_list[$field_name]);
     // Build destination path.
     $destination_path = 'public://' . $field_instance['settings']['file_directory'];
     foreach ($replica->{$field_name} as $language => $field) {
       foreach ($field as $key => $value) {
         // Fid can't be empty.
         if (!empty($value['fid'])) {
           $new_file = file_copy((object) $value, $destination_path);
           $replica->{$field_name}[$language][$key] = (array) $new_file;
  • I use the Node clone module. Wow, thanks for that detailed answer. The funny thing is that my site has been online for about 2 years, and I never had this behaviour before. So there is maybe some new conflict because of recently added modules or code. But I will give your code a try. Thanks again.
    – TBJ
    Jan 27, 2017 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.