Let the user compress and download all files that are uploaded in a node when they visit '/download_node/node/{nid}' without worrying about file field names.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manish-31 created an issue. See original summary.

manish-31’s picture

Status: Needs work » Needs review
FileSize
2.07 KB

This patch adds the required feature:
Create a content type with any number of file fields with whatever machine name you want. Now visit '/download_node/node/{nid}' you will be able to download all the files present in the node.

manish-31’s picture

Issue summary: View changes
manish-31’s picture

FileSize
3.79 KB

Patch #4 adds the required feature:
Create a content type with any number of file fields with whatever machine name you want. Now visit '/download_all_files/node/{nid}' you will be able to download all the files present in the node with ID {nid}.
The feature to download only selected files(by providing their field names) will be added in this issue

Dinesh18’s picture

Status: Needs review » Needs work

I tried to apply the patch but patch is getting failed.

$ git apply -v 2988346-4.patch
Checking patch src/Controller/DownloadNodeController.php...
error: while searching for:
{
    public function download($type, $nid)
    {
        $node_files = array();
        if ($type == 'node' && is_numeric($nid)) {
            $nodeID = $nid;
        }

error: patch failed: src/Controller/DownloadNodeController.php:14
error: src/Controller/DownloadNodeController.php: patch does not apply
Checking patch vfd.module...
error: while searching for:
use Drupal\file\Entity\File;


function files_node($nid)
{
    $node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);

error: patch failed: vfd.module:7
error: vfd.module: patch does not apply
Checking patch vfd.routing.yml...
error: while searching for:
    _title: 'Download Files'
    _custom_arg: '{path}'
  requirements:
    _permission: 'access content'
error: patch failed: vfd.routing.yml:15
error: vfd.routing.yml: patch does not apply
manish-31’s picture

Status: Needs work » Needs review
FileSize
3.33 KB

Thanks @Dinesh18 for applying the patch.
Please apply patch #6 and review it.
Read the comment #4 to use it properly.

gaurav.kapoor’s picture

Status: Needs review » Needs work

Still doesn't work. Please check coding standards as well.

ravi.shankar’s picture

Category: Task » Feature request
AkashKumar07’s picture

Assigned: manish-31 » AkashKumar07

gaurav.kapoor’s picture

Assigned: AkashKumar07 » Unassigned
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.