Solved

Download File With Images

Posted on 2002-05-02
4
227 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 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

735 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