Things to note when uploading files in php

巴扎黑
Release: 2016-11-22 09:20:57
Original
1195 people have browsed it



In order to allow client users to upload files, we must provide a form in the user interface for submitting uploads File request. Since the uploaded file is a special kind of data, different from other post data, we must set a special encoding for the form

You may not be familiar with the above enctype attribute, because it is often ignored. However, if the http post request contains both regular data and file-type data, this attribute should be displayed and added, which can improve compatibility with various browsers. Next, we have to add a user to the form Fields of upload files: 件 & lt; input name = "Attachment" Type = "File" & GT;


                                                                                         ; Input value = "Upload attachment" type = "submit" & gt;
& lt;/form & gt;
Tip: You can set the maximum value of the upload file through the upload_max_filesize in php.ini. In addition, there is a post_max_size that can also be used to set the maximum form data allowed to be uploaded. The specific meaning is the sum of various data in the form, so you can also control the maximum value of uploaded files by setting this field. However, note that the value of the latter must be greater than the former, because the former is part of the form data of the latter

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!