-2

The user uploads a .tar.gz archive and I need to validate if the archive contains a certain file (I just need to check the filename, nothing else).

I know I can open the file using \PharData however it seems that it loads the entire archive into memory. Since the archive is a backup and can easily be bigger than memory_limit, I can't use this.

How can I do the validation without loading the whole file to memory? In case it is impossible to do in PHP (as I suspect), how can I do it in bash? Again without loading the entire file to memory at once and also without actually unpacking the archive.

enumag
  • 830
  • 11
  • 21
  • Have you tried it via the phar:// stream wrapper? [Link](https://stackoverflow.com/questions/4878792/how-can-i-read-a-tar-gz-file-with-php) – Siqu Apr 03 '19 at 13:34

1 Answers1

-1

you just can use bash command for that:

tar -t - show list of files

enter image description here

myxaxa
  • 1,391
  • 1
  • 8
  • 7