creating a flexinode with some text, a textarea and an image does not give the expected result.
the image upload does not work.
there seem to be two bugs:

1.) image with "(" in the filename apparently are not accepted
2.) not depending on the filename the images are simply not uploaded.

i applying the latest patch to upload.module did not change the situation.

you may want to check out http://www.bruesselerplatz.de/ for reference.

cheers,

markus

Comments

trta’s picture

Title: image upload does not work » i have the same problem...

Images/files not uploading,
in addition, I get following warning after submiting new flexinode content

* warning: Attempt to assign property of non-object in H:\Web\workspace\rr\modules\flexinode\field_image.inc on line 47.
* warning: Attempt to assign property of non-object in H:\Web\workspace\rr\modules\flexinode\field_image.inc on line 48.

in this function

function flexinode_field_image_insert($field, $node) {
  $fieldname = 'flexinode_'. $field->field_id;
  $node->$fieldname = file_save_upload($node->$fieldname, $node->$fieldname->filename);
  $node->$fieldname->smallpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_sm', $field->options[2]);
  $node->$fieldname->thumbpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_th', $field->options[3]);
  $serialized = is_object($node->$fieldname) ? serialize($node->$fieldname) : '';
  db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data, serialized_data) VALUES (%d, %d, '%s', '%s')", $node->nid, $field->field_id, $node->$fieldname->filename, $serialized);
  return $node;
}
trta’s picture

Title: i have the same problem... » image/file upload does not work

sorry for changing the title..

scroogie’s picture

This could be connected to this bug http://drupal.org/node/38924

trta’s picture

I've already applied field_image.inc patch.. no change..
Neither uploads via upload.module doesnt work.. strange..
tried also with js off - no change..
isnt browser related.. tried in IE6, FF1.5

comx’s picture

had the same (didn't tested the image field - i need only files) - the uploaded file was not copied to files directory and the database field was empty.

compared the new field_file.inc with the old one (4.6) and did the following:

field_file.inc on line 34:

function flexinode_field_file_insert($field, $node) {
  $fieldname = 'flexinode_'. $field->field_id;
  $serialized = is_object($node->$fieldname) ? serialize($node->$fieldname) : '';
  db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data, serialized_data) VALUES (%d, %d, '%s', '%s')", $node->nid, $field->field_id, $node->$fieldname->filename, $serialized);
}

changed to:

function flexinode_field_file_insert($field, $node) {
  $fieldname = 'flexinode_'. $field->field_id;
    //changed code:
  $node->$fieldname = file_save_upload($fieldname, variable_get('file_directory_path', 'files'));
  if (empty($node->$fieldname)) {
    $node->$fieldname = ($node->{$fieldname .'_old'});
  }
    // eof change
  $serialized = is_object($node->$fieldname) ? serialize($node->$fieldname) : '';
  db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data, serialized_data) VALUES (%d, %d, '%s', '%s')", $node->nid, $field->field_id, $node->$fieldname->filename, $serialized);
}

i suppose its not the right way since there must have been a reason why this was splited into two functions in 4.7, but it works for me.

Bèr Kessels’s picture

Status: Active » Needs work
scroogie’s picture

Does editing entries with files / images work for you? On my installation it wants to upload new files even if I dont choose new files in the file-boxes.

comx’s picture

Status: Needs work » Needs review

the update didn't work, another fix, works for me:
field_file.inc, after line 33:

function flexinode_field_file_insert($field, $node) {
  $fieldname = 'flexinode_'. $field->field_id;
  $node->$fieldname = file_save_upload($fieldname, variable_get('file_directory_path', 'files'));
  if (empty($node->$fieldname)) {
    $node->$fieldname = ($node->{$fieldname .'_old'});
  }
  $serialized = is_object($node->$fieldname) ? serialize($node->$fieldname) : $node->$fieldname;
  db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data, serialized_data) VALUES (%d, %d, '%s', '%s')", $node->nid, $field->field_id, $node->$fieldname->filename, $serialized);
}

function flexinode_field_file_delete($field, $node, $unconditional = 0) {
  $fieldname = 'flexinode_'. $field->field_id;
  $result = db_fetch_object(db_query('SELECT serialized_data FROM {flexinode_data} WHERE nid = %d AND field_id = %d', $node->nid, $field->field_id));
  $file = unserialize($result->serialized_data);
  $node->$fieldname = file_check_upload($fieldname);
  if ($unconditional || ($node->$fieldname != $file and !empty($node->$fieldname)) ) {
    file_delete($file->filepath);
  }
}

this is just for file field, the image field should be similar.

dlr’s picture

Version: » 4.6.x-1.x-dev

It can't be similar, though the validate fonction is used to modify node field value, which is not allowed with 4.7 API.
Hope it helps

Bèr Kessels’s picture

Version: 4.6.x-1.x-dev » master
Status: Needs review » Needs work

please provide a real patch. http://Drupal.org/diffandpatch

markus61’s picture

Component: Code » flexinode.module (core)
Status: Needs work » Fixed

consider this one to be fixed

Anonymous’s picture

Status: Fixed » Closed (fixed)