@adan
To download all files from a directory using Codeigniter, you can create a controller method that loops through all the files in the directory and initiates a download for each file.
Here is a step-by-step guide on how to achieve this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
public function downloadAllFiles() { $directory = '/path/to/directory'; // Specify the directory path $this->load->helper('download'); // Get all the files in the directory $files = scandir($directory); // Loop through each file and initiate the download foreach ($files as $file) { if (is_file($directory . '/' . $file)) { $data = file_get_contents($directory . '/' . $file); force_download($file, $data); } } } |
Note: Make sure to handle permissions and security considerations while allowing users to download files from your server.