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,
Thanks for the fantastic module.
I have a content type based on cck file field which allows users to upload files. I want to allow them to download these files from multiple nodes. Can you please suggest a suitable method to allow selected files to be downloaded as tar/zip or alternatively can this be added as a new bulk operation?
Many thanks,
Rajat
Comments
Comment #1
infojunkieYou need to write a new action that performs the following in its execution function:
* Iterate over each selected node
* Find the file path(s) for each filefield
* Add the relevant path to a zip file using the PHP Zip API
* Set the PHP headers to the zip MIME type
* Write the zip file to the PHP output stream
I'm not sure I can get to this feature soon, so feel free to go ahead with an implementation. I'd be glad to help out.
Comment #2
acushla CreditAttribution: acushla commentedThanks a lot for the quick reply :)
I'm keen to get started on this. Ill Keep you posted on my progress.
Comment #3
acushla CreditAttribution: acushla commentedHi Karim,
I just got started with this. I have reached a stage where I have created an action that performs a task on each of the selected nodes. The problem is that we will need to have all the nodes going into the same zip file. Is there a way to identify the start and end of the action sequence that takes place? Please suggest if I am thinking on the right lines for what the action should do. The pseudo code is attached below:
action(){
if (is_first_call()){
create_archive();
}
add_file_to_archive();
if (is_last_call()){
close_archive();
}
Comment #4
infojunkieI missed that point, sorry.
Take a look at this thread, that outlines how to create an aggregate action that accepts an array of nids for all selected nodes, instead of receiving node objects one by one. Your logic will then act just once and you can loop on all nodes.
Comment #5
scottrouse CreditAttribution: scottrouse commentedThis is a great feature request. It's one that I've been looking for, as well. The programming is probably over my head, but if I can help with testing in any way, feel free to let me know. I might be able to toss in somewhere around $100 as a bounty for this feature.
Comment #6
infojunkie@scottrouse: I've been independently working on file download with VBO. The latest 6.x-1.x-dev release contains a new action called "Download archive of selected files". Note that this action only works for *File* views - please try it and give your feedback here. I am still thinking of how to design a similar action for *Node* view - your suggestions are welcome.
Comment #7
infojunkieAlso check out ImageField Archive for imagefields.
Comment #8
barckhoff CreditAttribution: barckhoff commentedHi,
I'm finding VBO very useful for my needs -- thank you for all the hard work! I'm also very keen to have bulk downloads of files. I tried installing 6.x-1.x-dev version to see how it works. After creating a File view and selecting the Bulk Operation style, I got the following errors:
warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/jobs.kemri/sites/all/modules/views_bulk_operations/views_bulk_operations_plugin_style.inc on line 222.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/jobs.kemri/sites/all/modules/views_bulk_operations/views_bulk_operations_plugin_style.inc on line 173.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/jobs.kemri/sites/all/modules/views_bulk_operations/views_bulk_operations_plugin_style.inc on line 93.
These errors display after I select "settings" for the Bulk Operations view style. In the settings panel, the list of "Selected operations" stops after the "Send e-mail (system_send_email_action)l" operation.
When using 6.x-1.9 version, I believe that my custom rule sets would normally appear directly after this operation, so I'm thinking maybe there's a formatting error or something in the call to custom rule sets?
Comment #9
bojanz CreditAttribution: bojanz commentedLet's try not to do 20 things at the same time here.
VBO now has download support for "file" views, and infojunkie was kind enough to create ImageField Archive that does the same for nodes.
If the current VBO -dev (6.x-1.x-dev) has any bugs with this, please open a separate issue.
Comment #10
NonProfit CreditAttribution: NonProfit commentedVBO now has download support for "file" views
Are there any plans to port "Download archive of selected files" functionality to VBO 7.x?
Thanks!
-NP
Comment #11
bojanz CreditAttribution: bojanz commented@NonProfit
See #1222844: Provide an action for creating an archive of selected files.
Comment #12
NonProfit CreditAttribution: NonProfit commentedbojanz,
Oops, thought I did a thorough search.
Thanks!