Download File With Images

Hello Experts!!

I am trying to download an htm file using the following code..

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"new.htm\"");
$fn=fopen("new.htm" , "r");

The file is downloaded fine but the problem is that there are some images in that particular htm files which are not getting downloaded.

Please advice...
Who is Participating?
jpoesenConnect With a Mentor Commented:
save the page to disk, parse the code for <img> tags, stack the SRC="..." values in an array and then write a loop in which every value gets concatenated with the original url and download the images.


download the file "".$src

Good luck
if you have multiple images in your page, this system will take ages :). Would you like to download....yes..Would you like to download....yes..........

as jpoesen said:
search for all images.
create an archive with tar and then zip the html file
and all images.
Then you can download it.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.