1

I have a little issue I try to add to my node with RESTful service on Drupal 7 multiple fids for a image gallery and I can't finish the process, I try

'field_gallery[und][0][]' => array(
  'fid:2381',
  'fid:2375',
),

and I don't know where I do it wrong. This is a request with php curl.

<div class="image-widget-data"><input type="file" class="form-file" size="22" name="files[field_gallery_und_0][]" id="edit-field-gallery-und-0-upload" multiple="multiple">
  <input type="submit" class="form-submit ajax-processed" value="Upload" name="field_gallery_und_0_upload_button" id="edit-field-gallery-und-0-upload-button">
  <input type="hidden" value="0" name="field_gallery[und][0][_weight]">
  <input type="hidden" value="0" name="field_gallery[und][0][fid]">
  <input type="hidden" value="1" name="field_gallery[und][0][display]">
</div>
1

I think what you really want is to end up with something more like:

'field_gallery[und][0]' => 2381,
'field_gallery[und][1]' => 2375,

The second level of array indexing is the field position. So the first file id goes into [0] and the second into [1].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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