PHP file upload using Zend Framework (1) _php tutorial

Source: Internet
Author: User
Tags php file upload upload php zend framework
The Zend framework is a popular PHP development framework that uses the Zend framework to quickly and easily implement common functions. This introduces you to the use of the Zend Framework to create file uploads, which can easily receive, confirm, and process files to be uploaded.

First, Introduction

Whether you're managing videos on YouTube, sharing PowerPoint presentations on SlideShare, or using the open source ecommerce platform Magento to update product images in the online store, we have the ability to upload Web-based file uploads. But how does this function work? How is the file transferred from the local machine to the remote server? This article will show the reader how to use the popular Zend Framework to create our own PHP file upload mechanism, which can easily receive, confirm, and process the files to be uploaded.

Second, the configuration processing file upload PHP

PHP itself can do file uploads via Web forms, but it is necessary to take some time to detect configuration artifacts that directly affect PHP's functionality, whether using standard PHP code or using the Zend Framework to manage file uploads, including:

File_uploads: This pseudo-directive enables the PHP file upload feature. By default, this pseudo-directive is enabled.
Upload_max_filesize: This pseudo-directive defines the maximum size of the file to be uploaded. By default, this pseudo-directive is set to 2M.
Upload_tmp_dir: This pseudo-directive defines the directory where PHP temporarily stores the files to be uploaded, which are temporarily stored in the file before the final destination is passed in, which is specified by the developer. By default, this pseudo-directive does not assign a value, which means that PHP will use the system's default values, for example, many Linux distributions have a temp directory of/tmp.
Post_max_size: Sets the maximum size allowed for post data. The default PHP post_max_size is 2M.
Max_execution_time: Although the relationship to the file upload is not very close, this pseudo-directive plays an important role in PHP's file upload function because it defines the execution time of the PHP script. For extremely large files, it may take a long time to transfer to the file server, so consider changing the default value of this pseudo-directive to 30 seconds to 60 or even 90 seconds.

Iii. creating a File Upload form

Below we will create a Web Form sample that can be used to browse the local computer's file system and determine which files to upload. We will do our best to keep the example simple, as shown in appearance 1 of the file upload form that was created.


http://www.bkjia.com/PHPjc/446398.html www.bkjia.com true http://www.bkjia.com/PHPjc/446398.html techarticle The Zend Framework is a popular PHP development framework that uses the Zend framework to quickly and easily implement common functions. Here to introduce you to the use of the Zend Framework to create the file upload function, the mechanism ...

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.