Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of downloading attachments in PHP IE

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to solve the problem of downloading attachments in PHP IE". In daily operation, I believe many people have doubts about how to solve the problem of downloading attachments in PHP IE. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "how to solve the problem of downloading attachments in PHP IE". Next, please follow the editor to study!

Key points:

1. Clear the cache before downloading attachments in IE.

2. The Chinese file name should be encoded with urlencode.

The copy code is as follows:

Header ("Pragma:"); / / if not added, the target host will be prompted in IE that it cannot be accessed.

Header ("Cache-Control:"); / / if not added, the target host will be prompted in IE that it cannot be accessed.

Header ("content-type: $type")

Header ("accept-ranges: bytes")

Header ("Content-Transfer-Encoding:base64")

Header ("accept-length:" Filesize ($path_c))

Header ("content-disposition: attachment; filename=" .urlencode ($filename)); / / garbled Chinese names without urlencode in IE

Readfile ($path_c)

Exit

Or

The copy code is as follows:

Header ('Content-Description: File Transfer')

Header ('Content-Type: application/octet-stream')

Header ('Content-Disposition: attachment; filename='.urlencode (basename ($file); / / garbled Chinese names without urlencode in IE

Header ('Content-Transfer-Encoding: binary'); / / binary transmission

Header ('Expires: 0')

Header ('Cache-Control: must-revalidate, post-check=0, pre-check=0'); / / if not added, the target host will be prompted in IE that the destination host cannot be accessed

Header ('Pragma: public'); / / if not added, the target host will be prompted in IE that the destination host cannot be accessed

Header ('Content-Length:'. Filesize ($file))

Ob_clean ()

Flush ()

Readfile ($file)

Exit

At this point, the study on "how to solve the problem of downloading attachments in PHP IE" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report