We're having trouble importing file attachments into Drupal 7. We have pdf and jpg files attached in Gathercontent. We are importing into Drupal File field, but whether selecting 1 or unlimited field values and correct allowed file extensions, it's always returning an error:

Operation failed:Invalid data value given. Be sure it matches the required data type and format.

As a side observation, importing pdf and jpg files into Drupal Image field produces no errors - files are visible in Drupal nodes but such nodes are unusable since there are errors when trying to modify and save those nodes in Drupal.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Arek Jankowski created an issue. See original summary.

mirom’s picture

Assigned: Unassigned » mirom

Thanks for reporting, we are currently looking on your problem

mirom’s picture

Please test with this patch.

mirom’s picture

Status: Active » Needs review
Arek Jankowski’s picture

Thanks for the patch, but it's still not working for us. The error we're seeing on the import page is:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=224&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: in dblog_watchdog() (line 163 of /var/www/html/modules/dblog/dblog.module).

Items without attachements still import fine.

mirom’s picture

Can you provide any additional information please? Error you posted is not from our module.

daniel.czegledi’s picture

I can reproduce the ajax error with the previous patch and i fixed it.

mirom’s picture

+++ b/gathercontent.module
@@ -1541,3 +1558,8 @@ function gathercontent_preprocess_views_view_table(&$variables) {
+
+function dummy() {
+  $field = field_info_field('field_image');
+  dpm($field);
+}

you probably want to remove this

and please provide interdiff

daniel.czegledi’s picture

Sorry! Yes i want to remove that code i fixed it

mirom’s picture

Status: Needs review » Needs work
+++ b/gathercontent.module
@@ -900,12 +900,16 @@ function gathercontent_gathercontent_process_choice_radio_field(EntityMetadataWr
+        foreach ($node->{$local_field_name}->value() as $file) {

$node->{$local_field_name}->value() should be probably $files

mirom’s picture

Fixing problem described in #10.

mirom’s picture

Rerolling for the latest head.

  • mirom authored 31c8751 on 7.x-3.x
    Issue #2761653 by mirom, daniel.czegledi: Importing file attachments in...
mirom’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.