开发者

Stop IE from redirecting before downloading a file

开发者 https://www.devze.com 2023-03-15 10:21 出处:网络
I am having a problem only with IE (tested in 8) and downloading, when i click the link it takes me 开发者_运维技巧to the server that the file is on before downloading it. The correct behavior should

I am having a problem only with IE (tested in 8) and downloading, when i click the link it takes me 开发者_运维技巧to the server that the file is on before downloading it. The correct behavior should be that the file download option pops up and the page is not redirected.

I am using a Kohana $this->request->redirect($file) to do the download.

Any ideas on why this would happen?

developing on localhost


You should use Response::send_file() for what you're trying to do.

$this->response->send_file('path/to/file.ext');

You can also use the current response object for this:

$this->response->send_file(TRUE,'download_file_name.ext');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号