In CMS, BBS, and other systems, there will be post module, and the article will contain attachments and images. When you click an attachment, the SAVE dialog box may appear and the browser will open it directly, for example, the connection
Public httpservletresponse download (string path, httpservletresponse response) {try {// path indicates the path of the file to be downloaded. File file = new file (PATH); // get the file name. String filename = file. getname (); // get the file
It is easy to use ASP. NET to output documents of the Word, Excel, txt, htm, and other types of specified content. It can be completed in three steps.
1. Define document type and character encoding
Response. Clear ();Response. Buffer =
HttpHandler1
(1) HttpHandler is a response to a request. It can output common html content, images, or a file (download)
(2) Output a dynamically created image (you can understand it)
(3) Case 1: Show visitor information in the image
(4) Case 2:
Php imports garbled characters into excel because utf8 encoding does not support all utf8 transcoding In the XP system.
UTF-8 encoding casePhp code
Copy codeThe Code is as follows: Header ("Content-Type: application/vnd. ms-excel; charsets = UTF-8 "
This is the code used to download the forum.
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Public void ProcessRequest (HttpContext context)
{
String name = "d :\\ abc.txt ";
// System. IO.
Wzskynet # 163.com
· Php escapeshellcmd multi-byte encoding vulnerability
· Explain in detail the application of the cache technology in PHP
· Use PHP V5 to develop multi-task applications
· Detailed parsing of PHP data sending process to MySQL
·
Php file download code (supports remote file download ). Php file download code (supports remote file download) * This article provides three file download codes, two of which support local server file download, you can download the php file
This article, "Learning from Servlet (vii)", continues to introduce its methods and functions from the HttpServletResponse response object.Using the SetHeader method in conjunction with the HTTP protocol's content-disposition response header, some
Php file download method. The article is also very simple. we only need to use the head to send the header information to download the file to the local file, directly sending header information, saving the file on the server, and then sending the
Python uses SMTP to send Mail SMTP (Simple Mail Transfer Protocol), which is a set of rules for sending Mail from the source address to the destination address, it controls the transfer mode of a letter.
Python's smtplib provides a convenient way
Example of php sending download of various types of files using headers
Header ('content-type: application/image/pjpeg '); // output type
Header ('content-Disposition: attachment; filename = "downloaded.jpg" ');
This article introduces the usage of Content-disposition in phpheader in detail. if you need to know the header usage, refer to Content-disposition as an extension of the MIME protocol, the MIME protocol indicates how the MIME user agent displays
PHP implements the download function code, implements secure download, and hides the real address of the file. For more information, see wzskynet # 163.com.
· Php escapeshellcmd multi-byte encoding vulnerability
· Explain in detail the application
Php download code
// Check whether all FORM fields are complete...
If ($ form_completed ){
Header ("Location: http://bbs.it-home.org/download/info_check.exe ");
Exit;
}
?>
Or the
How to solve the Chinese garbled characters problem during php cross-browser file download
/**
* Cross-browser file download and Chinese garbled characters
* Edit bbs.it-home.org
*/
$ Ua = $
PHP forcibly downloads the file code. Copy the code as follows :? Php?filename1.png; header (Content-Type: applicationforce-download); header (Content-Disposition: attachment; filename. $ filename.); echo $
The code is as follows:
$
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.