bgondy
bgondy

Reputation: 1338

CakePHP : force to download an external file using mediaViews

I'm working on an application using cakephp and I want to force a jpeg download.

So far, so good, by using mediaViews... but the file is'nt hosted on the server because i'm using a soap webservice and I just get a full jpeg file url. Is there a way to use mediaViews in cakePHP with an external link such as http://mywebsite.com/foo/bar/picture.jpeg without download it before saving it on the cakephp webroot folder?

Sorry for my poor english, I try to do my best...

Thanks in advance.

Upvotes: 0

Views: 777

Answers (1)

jeremyharris
jeremyharris

Reputation: 7882

No, you cannot force an object you don't have control over to be downloaded. This is because the headers that make it downloadable ('Content-disposition: attachment') are set by the responding server. For example, if I tried to force download an image from Google there's no way for me to set the headers on it.

Upvotes: 1

Related Questions