Question

This is my case: A user uploads a .rar file containing multiple files.

The .rar file is shown and downloadable.

But how to implement a function on the front end that would show the .rar file to be downloaded with a link (the whole file) and then all child files in the .rar could be shown for download also (one at a time)?

Here is what the output would look like on the front end:

   These files are available for download:

   -[link]raredfile.rar   (linked to download: the whole rar file)
      -[link]file 1       (linked to download: file 1 in the .rar file)
      -[link]file 2       (linked to download: file 2 in the .rar file)

Is is possible? If so could you give me some pointers what to use and how?

Thank you for answering.

Regards.

Was it helpful?

Solution

1. Upload the .rar

upload your .rar file.
store on a folder:
example:

project/files/rar.rar

2. Extract .rar

extract your .rar file.
now you should have 2 files with the same name:

project/files/rar.rar - rar file
project/files/rar/ - folder

3. Downloading the files

now you can display all the contents of the folder using a backend language.
example:

  <a href="project/files/rar.rar">raredfile.rar</a>  (linked to download: the whole rar file)
  - <a href="project/files/rar/file1.txt">file 1</a>   (linked to download: file 1 in the .rar file)
  - <a href="project/files/rar/file2.txt">file 2</a>  (linked to download: file 2 in the .rar file)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top