Open/Save Dialogue Box, Remote Host

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ajacian
Forum Newbie
Posts: 4
Joined: Wed Jan 28, 2009 10:08 am

Open/Save Dialogue Box, Remote Host

Post by ajacian »

Hey everyone,

Sorry if this has been asked before, I searched but couldn't find anything. The issue i'm having is that we have a partner who serves downloadable images for us; users can click a link on our site and they will be presented the image to download. The partner serves it as a standard JPG, and therefore loads it directly into the browser; however, we need to issue a FILE/SAVE Dialogue box to the user. Unfortunately, we are not able to ask the partner to change anything from their side; what we've had to resort to doing was Saving the image to oursite and then popping up the File/Save Dialogue box. Unfortuneatly, this too is no longer an option due to the long wait times for our users and bandwidth issues. Is there ANY way we can directly link to the image on our partner's site and display the F/S Dialogue Box?

Thanks in advance,
-ajacian
ajacian
Forum Newbie
Posts: 4
Joined: Wed Jan 28, 2009 10:08 am

Re: Open/Save Dialogue Box, Remote Host

Post by ajacian »

any help?
ajacian
Forum Newbie
Posts: 4
Joined: Wed Jan 28, 2009 10:08 am

Re: Open/Save Dialogue Box, Remote Host

Post by ajacian »

please?
mickeyunderscore
Forum Contributor
Posts: 129
Joined: Sat Jan 31, 2009 9:00 am
Location: UK

Re: Open/Save Dialogue Box, Remote Host

Post by mickeyunderscore »

Try the following: (I ran this and it worked for me, using Firefox 3.0.5)

Code: Select all

 
$f = file_get_contents($image_location);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-Type: image/jpeg');
header('Content-Disposition: attachment; filename="test.jpeg"');
header("Content-Transfer-Encoding: binary");
echo $f
 
Don't think this will solve the bandwidth problem though, but it will save you having to copy images over
ajacian
Forum Newbie
Posts: 4
Joined: Wed Jan 28, 2009 10:08 am

Re: Open/Save Dialogue Box, Remote Host

Post by ajacian »

i appreciate the help, thank you. However it's still being (even if very temporarily) copied to the server via file_get_contents. I can no longer ready any of the contents of the file to the server.
Post Reply