Solved

Download File With Images

Posted on 2002-05-02
4
219 Views
Last Modified: 2010-08-05
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");
fpassthru($fn);

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...
0
Comment
Question by:suman_m
4 Comments
 
LVL 2

Accepted Solution

by:
jpoesen earned 100 total points
ID: 6985372
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.

example:
src="/pics/splashscreen.gif"

download the file "http://www.theDomainName.com".$src

Good luck
jpoesen
0
 
LVL 8

Expert Comment

by:us111
ID: 6985555
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.










0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question