?
Solved

Download File With Images

Posted on 2002-05-02
4
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
jpoesen earned 400 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

719 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