这是我的案例:用户上传包含多个文件的 .rar 文件。
显示.rar文件并可下载。
但是如何在前端实现一个功能,该功能将显示要下载的 .rar 文件以及链接(整个文件),然后也可以显示 .rar 中的所有子文件以供下载(一次一个)时间)?
这是前端的输出:
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)
有可能吗?如果是这样,您能给我一些使用方法和方法的指导吗?
感谢您的回答。
问候。
最佳答案
1。上传.rar
上传您的 .rar 文件。
存储在文件夹中:
示例:
项目/文件/rar.rar
2。解压.rar
提取您的 .rar 文件。
现在您应该有 2 个同名文件:
project/files/rar.rar
- rar 文件
project/files/rar/
- 文件夹
3。下载文件
现在您可以使用后端语言显示文件夹的所有内容。
示例:
<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)
关于javascript - 上传 .rar 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23649514/