The best time to register for DrupalCon Dublin is now. Earlybird discounts end July 29.
I would like to action each file as soon as it is uploaded to the server.
What is the right way to do this without hacking the code of the module?
Plupload for D7 only provides form element that can be used by other modules. It does not create any nodes or similar.
If you need functionality similar to D6 you need to create a module that will depend on this one.
I understand that, and we have a custom module to create nodes for plupload files. What I am looking for is a hook (e.g. file_uploaded) that we could use to action file (put to a corresponding queue for example) as soon as it reaches the server. In our use case processing them in form_submit is not ideal.
Can you explain why is form_submit unsuitable for your needs?
We expect users to load hundred of files (images) in one go. This takes from 30 min to few hours. Once process is complete it calls form_submit. In my view this has 2 drawbacks:
1. Users have to see stalling page while form_submit creates nodes (I guess this can be improved by queues).
2. We put unnecessary load on the server by processing all files in one call (creating nodes, image cache, moving them around etc.)
If we had a callback for each file both issues would be resolved. We had an experiment where our processing was injected into plupload_handle_uploads function. But it would be great to find a way to do this without hacking module's code.
We could expose a hook, as you already suggested. Can you post a patch?
I have added the hook file_uploaded. it has $fileinfo argument that contains temporary path and original name of the file.
It generally looks OK. I think we shouldn't post watchdog messages for every chunk (or even every file). I'd remove this or at least use a variable that would enable/disable this debug messages. Messages should be disabled by default in the latter case.
Yes, sure feel free to remove the watchdog. I left it for debugging purposes only.
Patch does not apply, so it probably needs a re-roll. I think we should also rename this hook to plupload's namespace, create api.php file and document this hook in it.
Plupload really helps to integrate the plupload plugin.. Really awesome...!
But currently all the files are adding in the queue, once it gets uploaded in the server (in the .tmp format). Upload submit is happening only after uploading all images and after that only we are able to see the thumbnail. I want to show the thumbnail immediately after uploading each image. Say for example, am uploading 10 images, and after image_1 gets uplaoded, process status changes to 100% and image_2 starts uplaoding. By this time I want to show the thumb nail of the image_1 in place of its name.
Is there any way to add this in this module? Thanks in advance for all your help.. :)
@sarath.rajan: This is not related to this issue. Please open new one. Most important question here is if Plupload library itself supports this.
Hi slashrsm, Thanks for your help..
I think plupload itself not support this.. :(
Is there any option to achieve this in drupal 7?
Drupal is a registered trademark of Dries Buytaert.