Solved

Download File With Images

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP Sum Column in Table 3 28
html input clean up 3 32
How do I access property of nested object in PHP? 3 25
PHP JSON Clean up 5 10
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now