The use of PHP code to force the download of the file type, sometimes require some files can not be opened online, but the implementation of the need to download, then use this function can be solved
function DownloadFile ($file) {/*coded by
PHP files cannot be uploaded successfully because they have exceeded the maximum file size. & nbsp; I recently studied HeadFirstPHP & amp; in MySQL, Chapter 1 "using data stored in files" appears when an error occurs during a file upload application,
$filename = "./". $_request[' name ']; Specific path, as long as $filename is the full path of the file to be downloaded
if (!is_file ($filename)) {//detects if the file exists.
Die (' Downloaded files like a TM who eloped! ');
}
2015-07-13
Elements
Property
is optional
Function
Async
Options available
Language
Options available
Deprecated, originally used to indicate that the scripting
1. The server outputs the corresponding HTTP Response Headers information through response and the data of the file to be downloaded to send the file to the client. The HTTP Response Headers is shown in the following form in the HTML file:HTTP-equiv
An android application consists of four components. For details about these four components, see "Composition of Android Applications ".
These four components are independent and can be called and coordinated to form a real Android Application.
Using the way HTML is stitched into table table, return fileresult output a binary file.The first type: using FilecontentresultCreate a Filecontentresult object by using the file contents, content type, file name//parameters: FileContents: Binary
1, the following directly to the demo, specific instructions to see code comments:public class Mainactivity extends Activity {@Override protected void onCreate (Bundle savedinstancestate) {s Uper.oncreate (savedinstancestate);
Using the PHP GD library to compress pictures, you can fill in the specific width and height for compression. So, can be compressed by percentage, such as compressed into the original 90%,80% .... such as?
Reply content:
Using the PHP GD
Cognitive Web server. In the opinion of many users, the success or failure of a Web website mainly lies in the content and functions provided by it. but the Web server that supports these content and functions is the real hero behind the scenes.
The first step. First of all use the regular to pull out from the article.
Copy the Code code as follows:
$message//article contentRegular (this is not yet)$reg = "/]*src=\" (http:\/\/(. +) \ (. +) \. ( JPG|GIF|BMP|BNP)) \ "/isu";Store the
There are many php file upload class, File upload processing is a feature of PHP (at least the manual is to be shown as PHP features, the individual think PHP in the array of excellent features more features), learn PHP people know how to upload
PHP by modifying the header to force the image download method,
This example describes how PHP enforces the download of images by modifying the header. Share to everyone for your reference. The implementation method is as follows:
function
thinkphp gzip compression is turned on by default
' Output_encode ' = true,//page compression output
The demand is like this
In an action, use the header to output a picture
Problem
Because thinkphp used the Ob_start
The page
In the opinion of many users, the success or failure of a Web website mainly lies in the content and functions provided by it. but the Web server that supports these content and functions is the real hero behind the scenes. According to statistics,
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.