Jump to content

Recommended Posts

Does anyone know hot to get a pop-up messagebox that allows visitors of an url (e.g. http://www.mysite.com/image1.png )to open / download  / cancel the file.

 

With a *.zip file it works automatic like http://mysite/test.zip but with an image the image automatically opens in your browser

Link to comment
https://forums.phpfreaks.com/topic/196968-how-to-opendownload-an-image/
Share on other sites

Whenever you link a person to part of your webpage, you are telling them to access a file on that page. The browser interprets what to do based on what kind of ending it is (php/html: display content, filetypes (zip, rar, bin, exe, etc.): show download, images: show image).

 

So, you can apparently set the header content-disposition which will override this behavior.

 

Look here: http://support.microsoft.com/kb/260519

 

I would take them to a php page that sets the header then jquery that loads the image and outputs it to the user? I'm not sure how to do this, to be honest. Actually, that wouldn't work. You would have to load the image with php so there would be no other html present, but do change the header. This could take some experimentation to get to work!

 

It's a lot simpler to educate the user perhaps with a hover tooltip/div of some kind?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.