3

My research seems to be indicating that only a single file control widget is possible per form when creating said form with the Forms API.

Is this true? Still?

I'm operating in D6, I don't want to use CCK because I want to keep my custom content type within a single DB table, but I do want to be able to upload multiple files - in separate form controls which lie in separate fieldsets from one another (logical context of what the file is for).

If one uses the CCK based upload options (such as those outlined here: How to upload multiple files at once?) as soon as multiple uploads are enabled, the content type's DB table gets fragmented by having the CCK upload control's data moved to its own DB table. I don't want that.

Is the only alternative to write some AJAX/AHAH logic handling this in the background, with the FAPI's file handling basically useless here?

  • In D7 there's not such problem, where have you read it's not possible in D6 ? Have you tried to implement it and got some error ? – tostinni Oct 28 '11 at 17:44
  • In a custom D6 module with multiple file upload widgets created via FAPI (not CCK), using the multiple widget to upload files simply does not work. When passing file_save_upload( file_widget_field_name ) for any file upload widget other than the first one, the return value is NULL. – Blake Senftner Nov 21 '11 at 16:24
2

I will recommend you to use:

print_r($_FILES);

This placed inside the form function submit will let you know if the files are been upload it into the temp directory and what are their names. Also check the file upload field name as sometimes when you copy and paste code you might be re-using the same name and this is creating the overwriting.

Last, but not least in your custom module try adding a single upload file field and test it if it work, then add a second and try it and so on.

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.