Read html file inside a zip file


#1

Hi,

How can I read html file inside a zip file with an iframe?
I upload an animated banner created in Hype as a zip file. I need to create an iframe that read the index.html from that zip for serving ad.

I read this on GitHub forum:
“One solution is uploaded the whole html (a index.html , js, css, images - all needed file must be in the zip file no external reference for security) as a zip file to server. Then current html will has an iframe to reference the uploaded html.”

This is how I use revive adserver to serve html5 at the moment.

I create an iframe but no chance to read the files inside the zip.
How can I do that?

Regards,
Mihnea


How To Integrate PHP into Tumult Hype
(Mark Hunte) #2

Well it seems it is possible to read a zip file using Hype and PHP.

On the server you need a php file that does the reading with code like this;

<?php
    $handle = fopen('zip://testInclude.zip#testInclude.html', 'r');
    $result = '';
    while (!feof($handle)) {
        $result .= fread($handle, 8192);
    }
    fclose($handle);
    echo $result;
    
    ?>

zipRead.php.zip (686 Bytes)

Along side that the zip file testInclude.zip (677 Bytes)
and the exported Hype project that just runs the php file and then displays the result.

zipRead.hype.zip (92.8 KB)

Two sources for info :smile:

and

http://php.net/manual/en/wrappers.compression.php


#3

Hi Mark,

Thank you for your reply. I will do a test tomorrow and I will let you know how it works.

Regards,
Mihnea