Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I have tried to use Plupload integration in my custom module but I couldnt upload file in _submit hook. Is there any example how can I upload images after form submitted.
Best Regards,
Comments
Comment #1
slashrsm CreditAttribution: slashrsm commentedFiles will be uploaded to a temporary location before _submit gets invoked. You should get them in $form_state when execution hits submit function and it is up to you what to do with them.
Sorry for a late reply. Hope it helps.
Comment #2
Romi CreditAttribution: Romi commentedI have tried to create a node and attach a file using plupload. Please guide me in this regard. In $form_state I am getting following array:
Comment #3
MaudeH CreditAttribution: MaudeH commentedHi "Drupalers" and an happy new year !
I've the same problem : what are we doing with this ?
file_save_upload, file_copy, file_move don't save the images (or files) in the public directory...
Thanks for your answers.
Regards,
MaudeH
Comment #4
MaudeH CreditAttribution: MaudeH commentedHi,
@Romi : just in case you need some help...
Comment #5
slashrsm CreditAttribution: slashrsm commentedThe easiest way is to use file_save_upload().EDIT:
My comment above is not entirely true. Better solution would be file_unmanaged_move(), file_uri_to_object() (part of file_entity but also implemented in plupload.module, so you don't need to install any dependencies) and/or file_move().
Comment #6
slashrsm CreditAttribution: slashrsm commentedComment #9
hargobindHere is my code in case it helps anyone: